See 7df6a309 and 83a87042. I didn't realize that light
userdata's metatable is shared--like numbers or strings.
So it cannot be paired with a metatable.
I also made a few minor tweaks to Lua cvars, other than
accounting for the double pointer in the userdata.
* Hooks are no longer a mess of lua boiler plate. Helper functions reduce hooks
to, at the most basic level, only two calls.
* Lua tables (the array part) are used to index hooks. Such tables contain only
hooks of the same type.
* Hook types are defined in one place so you no longer need to sync up the enum
and name array.
Index and take length of tag lists like a table, 1-indexed. There are three
methods which may be used on tag lists:
list:iterate() - returns an iterator over the tags in the list
list:has(tag) - returns a boolean whether the tag is in the list
list.shares(list2) - returns whether two lists share a tag
"find" is also an alias to "has". Each method may be accessed from the global
taglist library too, e.g. taglist.iterate(list)
Tag lists may be compared with an equality operator too. This will tell you if
the two lists are composed of identical tags.
Accessible from sector.taglist, line.taglist and mapthing.taglist.
The global "tags" can be iterated upon for every unique tag which is set in the
level. If a tag is set on a sector/line/thing, it will be included. Taking the
length of "tags" will give you the number of these unique tags. (If a tag is
set on multiple sectors/lines/things, it will only be counted once though.)
For sectors, lines and mapthings, call the field "tagged". This function takes
one argument, which is the tag. The return value can be iterated over for all
the sectors/lines/things with that tag. The length can also be taken for the
number of such objects. If no argument is given, the global tag is default.
To re-enable support for the above, uncomment the define HAVE_LUA_SEGS line in lua_script.h. Plain bbox userdata stuff is not disabled (though currently it's not used anyway)
There is a caveat to this: The first time EvalMath is used, a
deprecated function warning will be shown to the user that tells
them to use _G[] instead.
This reverts commit 9d36cf37bd.
That's supposed to be run once a frame, not once per hook
per mobj per frame you moron. If you just run it seven
thousand times a frame, of course your framerate will drop.
Angles now go from 0 to 0xFFFF (360 degrees == FRACUNIT) instead
of using a full UINT32. Lua only has one number type, so signedness
gets in the way of using angle_t directly. This handling of angles
matches up with how ZDoom ACS scripting and the like does it.
I also changed all the integer casts and pushes of fixed_t to
their own macro in preperation for possible future seperation.