Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Article about Strings and chars #246

Open
ivan-mogilko opened this issue Mar 31, 2024 · 2 comments
Open

Article about Strings and chars #246

ivan-mogilko opened this issue Mar 31, 2024 · 2 comments
Assignees

Comments

@ivan-mogilko
Copy link
Contributor

ivan-mogilko commented Mar 31, 2024

I think there should be a separate article dedicated to Strings and characters, explaining the basics, and also about writing literal values (literal strings and literal characters). Among other things it needs to mention escaped sequences (\", \n). I think I saw that somewhere in the manual, but cannot find now.

@ivan-mogilko ivan-mogilko changed the title Article about Strings and characters Article about Strings and chars Mar 31, 2024
@ericoporto
Copy link
Member

I imagine it would go to the scripting language section.

https://github.com/adventuregamestudio/ags-manual/wiki/ScriptingLanguage

There's an entry there for String Formatting specifically, should it be kept as a separate article - I imagine there are links to it specifically from the functions that use it - or should it be joined in the same article? I am leaning to leave it separate but not sure on it.

This means we need a name for chapter, something like Using and writing Strings in AGS - I would keep chars in absence of the title because the name may be confusing.

I am going to briefly look into python official docs only for inspiration... In python the formatting is thrown along the string methods - in AGS this would be where strings are in the script API. https://docs.python.org/3/library/string.html

There's an entry in the python docs for string literals too (https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals), but it's written like it's talking to someone writing a parser, not very friendly, but has some interesting tables and notes how escape works.

@ivan-mogilko
Copy link
Contributor Author

ivan-mogilko commented Mar 31, 2024

String formatting is a separate topic, but may be linked from this one.
Title may be "Using Strings" or "Working with strings".

It should explain that there's a String type (reference String API).
Explain how to assign strings with string literals; mention any nuances with literals, like can they wrap onto next line (iirc old compiler had troubles with that).
Explain escaping within string literal (\", \n etc).

Tell that Strings consist of characters, and that characters are different depending on ASCII and Unicode text mode in game.
Explain character literals, how are they written; explain how character literals relate with numbers.

For advanced users: explain what const string syntax means, and how it may make custom functions slightly faster.

@ericoporto ericoporto self-assigned this Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants