[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Embedding Lua twice?
- From: Sean Conner <sean@...>
- Date: Thu, 27 Nov 2014 22:51:56 -0500
It was thus said that the Great Thiago L. once stated:
> Hi! Is there any way to have Lua 5.1 (actually LuaJIT) and Lua 5.2
> (LuaJIT doesn't support _ENV) on the same program?
I just realized that this question can be interpreted in two ways:
1. Can I have a Lua interpreter that includes both LuaJit and Lua
5.2?
2. Can I write Lua code that runs under LuaJIT and Lua 5.2?
The answers so far have been for #1, but for #2, it gets a bit klunky,
but:
if _VERSION == "Lua 5.1" then
if _G.jit then
-- do LuaJIT specific code
else
-- do Lua 5.1 specific code
end
elseif _VERSION == "Lua 5.2" then
-- do Lua 5.2 specific code
else
-- do Lua 5.3 specific code
end
-spc