-
-
Notifications
You must be signed in to change notification settings - Fork 438
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
New Lua constants (#3022) #3039
base: master
Are you sure you want to change the base?
Conversation
I think that the length of these constants makes them cumbersome and difficult to use. I doubt that long constructions like |
In addition, I would suggest to make the table read-only. |
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.
Fine for me, just maybe other people may have concern about names, but apart of that it is good to go
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.
Also, whats the point of not directly assigning the values to constants.*
but instead making a local
var first?
If there's no good reason, then we should just assign it directly [this also reduces the chance of interfering with existing scripts]
Also, there's a chance that some scripts might break if these constants are loaded into every script, we should have a meta.xml
toggle for it, that toggles this feature per-resource [as theres one LuaVM per resource]
Also... I'm not sure if constants
is the solution.
Perhaps we should just push them into the global namespace? [Like KeyStates.Up
rather than constants.KeyStates.up
.]
[I'm sure some people would prefer the one over the other]
And, as @tederis noted, making the tables read only might be useful [though Lua is somewhat limited in that regard]
Also something I just realized, these constants are pretty useless on their own. local MyEnum = {
First = 1
}
|
Tables are now read only; Better value handling
b003148
to
a46735d
Compare
What would we rename them to? 🤔
Implemented. Thanks for the suggestion ❤ |
This PR is a direct response to the #3022 feature which adds new global variable:
constants
and assigns new fields to it: