I am writing some test scripts for my Lua project and I want to be sure that they run correctly under the different Lua versions available. Since my unit testing framework can use the wrong Lua version if I misconfigure it, I would like to be extra safe and check at runtime what Lua version my tests are running under. What would be the best way to do that?
I know that a quick way to tell 5.1 and 5.2 apart is to check the _VERSION
global but how can I tell regular Lua 5.1 and LuaJIT apart?
local is_LuaJIT = ({false, [1] = true})[1]
– Mullite