You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I addressed this locally in my theme specification, but currently table keys are default highlighted as strings when you declare them, but then as variables when you call them. I'd suggest defaulting them to highlighting as strings in both contexts, as long as the table key isn't also a function name - so
table.key = table is a variable, key is a string
table.key(value) = table is a variable, key is a function
Lua (and JavaScript for that matter) are special because their mapping data structures have double-duty and serve as both arbitrary key-value storage as well as objects that may have members. Most significantly, they also use the same syntax for both.
Ideally, in alignment with almost all other languages, I'd like to treat direct member access as a variable.member and not as a string. However, in definitions, both are common, although I would argue defining table values manually for the object style usage is more common than the arbitrary key-value because you're more likely to use brackets for indexing there, so I would rather change definitions to something like entity.name.member instead of changing access to string.
deathaxe
changed the title
Lua suggestion - table keys when called should also be strings not variables
[Lua] suggestion - table keys when called should also be strings not variables
Aug 31, 2021
I addressed this locally in my theme specification, but currently table keys are default highlighted as strings when you declare them, but then as variables when you call them. I'd suggest defaulting them to highlighting as strings in both contexts, as long as the table key isn't also a function name - so
table.key = table is a variable, key is a string
table.key(value) = table is a variable, key is a function
Screenshot
Code -
The text was updated successfully, but these errors were encountered: