Skip to content

Stop using metatables with light userdata

James R. requested to merge light-userdata-is-wrong into next

See !583 (merged), !754 (merged) and !1238 (merged). At the time I did not realize that light userdata metatables are not unique to each value. (Recently it was discovered that accessing the skin sprites list would override the metatable of a cvar from CV_FindVar.)

I started using light userdata because Lua CV_RegisterVar would allocate the cvar as userdata, meaning CV_FindVar wouldn't be able to return a reference to any cvar that wasn't registered by Lua. Well, not without making it use LUA_PushUserdata, that's what I did here.

Merge request reports