lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Jul 20, 2020 at 1:53 PM Dmitry Meyer wrote:
"A tricky way to determine Lua version":
http://lua-users.org/lists/lua-l/2016-05/msg00297.html

local f, t = function()return function()end end, {nil,
   [false] = {[-1/0] = 'Lua 5.1', [1/0] = 'Lua 5.4'},
   [true]  = {[-1/0] = 'Lua 5.2', [1/0] = 'Lua 5.3'},
   [1]     = 'LuaJIT'}
local version = t[1] or t[f()==f()][1/'-0']