Expose a `constants` dictionary to Lua.
- Dec 31, 2023
-
-
Logan Aerl Arias authored47b34b34
-
- Oct 29, 2023
-
-
Alam Ed Arias authored51c3dd3f
-
- Nov 07, 2021
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
Had to split the main comparison portion of lib_getenum to a new function getEnum to do so.