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

Clarify GDScript dictionary syntax restrictions #99285

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Nov 15, 2024

  • Document keys being quotable in Lua-style dictionary syntax, which can be used to bypass its limitations.
  • Mention duplicate dictionary keys being forbidden in declarations.
  • Mention that dictionary styles can't be mixed in a single declaration.

- Document keys being quotable in Lua-style dictionary syntax,
  which can be used to bypass its limitations.
- Mention duplicate dictionary keys being forbidden in declarations.
- Mention that dictionary styles can't be mixed in a single declaration.
@Calinou Calinou requested a review from a team as a code owner November 15, 2024 14:29
# Doesn't require quotes around keys, but only string constants can be used as key names.
# Additionally, key names must start with a letter or an underscore.
# Additionally, for key names to be usable without quotes, they must start with a letter
# or an underscore and must not be reserved identifers (such as `class` or `while`).
# Here, `some_key` is a string literal, not a variable!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be changed?

Here, some_key is a string literal

If it was true, {class = "xyz"}, class would be a string literal, but parser don't understand it.

@Calinou Calinou added enhancement documentation cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release labels Nov 15, 2024
@Calinou Calinou added this to the 4.4 milestone Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release documentation enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot use keywords inside dictionary with Lua-style syntax
2 participants