lua-users home
lua-l archive

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


John Belmonte wrote:
For Lua packagers: I realized that to support multiple installed
versions of Lua, versioned aliases of the Lua environment variables
(LUA_INIT, LUA_PATH, and LUA_CPATH) are needed.  I propose names as
follows (e.g. for Lua 5.1):

  LUA_5_1_INIT
  LUA_5_1_PATH
  LUA_5_1_CPATH

If a versioned alias is set, it takes precedence over the non-versioned
variable.

--John



To use multiple versions of Lua one may use
a script analyzing _VERSION variable, e.g.:

-- environment variable
LUA_INIT=@c:/lua/init.lua

-- file c:/lua/init.lua
local v = string.sub(_VERSION, 5, 7)
if v == "5.0" then
    dofile("c:/lua/5.0/compat-5.1.lua")
else
    dofile("c:/lua/5.1/init.lua")
end

--
Shmuel