3 ms·
> This is the reason that game consoles disallow JIT-compilation - and hence games tend to use regular Lua rather than LuaJIT. You can disable the JIT in LuaJI
by DarkWiiPlayer 6y ago
> This is the reason that game consoles disallow JIT-compilation - and hence games tend to use regular Lua rather than LuaJIT.
You can disable the JIT in LuaJIT and still get better performance because it's a different implementation of the VM.
> but I'd be surprised if it could prevent a script from running indefinitely.
You'd have to patch the standard library a bit to avid things like `string.find` causing trouble, but as far as core Lua features go, yes, you can do that and all you need is to install a debug hook (Preferably from C, because performance, but you can even do this 100% from within Lua)
-----
EDIT: Here's some benchmarks I did for this a while ago https://gist.github.com/DarkWiiPlayer/f639a38df53e39df63497cc18e8d0498 https://gist.github.com/DarkWiiPlayer/f639a38df53e39df63497c...