lua-users home
lua-l archive

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




Am 21.05.2016 um 07:18 schrieb Egor Skriptunoff:
I want to share simple program that determines Lua version.

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

I like it. Its a nice pice of code. Thank you for sharing this. :)

-- Egor

Ulrich