C people:
lib_getenum
works functionally identically to how it worked before I made any changes.getEnum
contains the main comparison portion.constants
userdata uses an anonymous metatable.Lua people:
constants
now exists for you to get the value of a constant, or check if it exists. This is helpful for seeing if a value in _G
is a constant or not.nil
with no errors.print(constants["FRACUNIT"]) -- 65536
userdata
and function
type variables are excluded from constants
, so A_*
and super
aren't considered constants.Attached is a Lua script you can use to test the code.
constantTable.lua