mtasa-blue icon indicating copy to clipboard operation
mtasa-blue copied to clipboard

New Lua constants (#3022)

Open TracerDS opened this issue 1 year ago • 4 comments

I think that the length of these constants makes them cumbersome and difficult to use. I doubt that long constructions like constants.VehicleLightOverride.Disable can be usefull. I would suggest to make them shorter.

tederis avatar May 24 '23 13:05 tederis

In addition, I would suggest to make the table read-only.

tederis avatar May 24 '23 13:05 tederis

Also something I just realized, these constants are pretty useless on their own. There should be a way to convert to/from name/value. Given:

local MyEnum = {
    First = 1
}

MyEnum['First'] should return 1. MyEnuim(1) should return First This is similar to how Python work (Though Python returns special EnumValue objects that we can't afford in terms of performance, so we're going with the simpler solution here).

Pirulax avatar Jan 06 '24 18:01 Pirulax