Hi!
I'm maintaining a long-term project and am looking to upgrade the Lua we are currently using to either 5.4.8 (or possibly just 5.5).
We had previously been using a slightly forked Lua 5.2.2 to add bitwise operators and an opcount counter. I am really pleased that we can get rid of those bits (thanks for much for LUA_MASKCOUNT_NUMOPS)
We have one remaining divergence from vanilla 5.2.2, which I would really love to get rid of, which is a patch adding a __usedindex metamethod, which is invoked by our freezing mechanism. I have a limited understanding of how this works exactly, and the code it touches in lvm.c has changed (luaV_settable vs luaV_finishset). My colleague explained our setup a little on the list here a few decades ago:
Anyway, the thing we accomplished with this was to freeze the globals entirely, so that chunks (which are semi-trusted code) run independently, and cannot alter the global table, either directory or indirectly, and furthermore are not allowed to alter system packages by e.g. pointing math.abs at something else, either directly or indirectly.
Thoughts about how to accomplish this in 5.4.8 or 5.5 soundly would be welcome.