-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Fix differences between String and StringName's documentation #95758
Fix differences between String and StringName's documentation #95758
Conversation
@@ -263,12 +263,12 @@ | |||
print("User {id} is {name}.".format([["id", 42], ["name", "Godot"]])) | |||
[/codeblock] | |||
See also the [url=$DOCS_URL/tutorials/scripting/gdscript/gdscript_format_string.html]GDScript format string[/url] tutorial. | |||
[b]Note:[/b] The replacement of placeholders is not done all at once, instead each placeholder is replaced in the order they are passed, this means that if one of the replacement strings contains a key it will also be replaced. This can be very powerful, but can also cause unexpected results if you are not careful. If you do not need to perform replacement in the replacement strings, make sure your replacements do not contain placeholders to ensure reliable results. | |||
[b]Note:[/b] Each replacement is done sequentially for each element of [param values], [b]not[/b] all at once. This means that if any element is inserted and it contains another placeholder, it may be changed by the next replacement. While this can be very useful, it often causes unexpected results. If not necessary, make sure [param values]'s elements do not contain placeholders. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intent was to make this much clearer without rearranging everything, but I am still not particularly fond of this at all. Makes it looks more complex than it really is.
This comment was marked as resolved.
This comment was marked as resolved.
d55372b
to
519351f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Thanks! |
The PR's title is pretty self explanatory. There have been changes done to String, but not applied to StringName. This PR fixes that, and tweaks a few other miscellaneous things on the way.
This is not the only class that suffers from subtle differences. Even one small difference adds a whole new string to translate. In my experience this was seriously irritating to see. Not to mention, the inconsistent information given between two similar classes does add up over time.
To all maintainers, please, pay attention to these kinds of classes before approving and merging.
I am aware it is a burden to maintain, but there's currently no system for shared documentation snippets for classes to share, only ideas.