|
Diego Nehab wrote:
If you have Lua 5.1 and Lua 5.0 installed on the same system, they will fight for control of variables LUA_INIT, LUA_PATH, and LUA_CPATH. What John proposed was that each version of Lua should check first for version specific environment variables, and only if those are not defined should Lua resort to the generic variables. For example, Lua 5.1 would first try LUA_5_1_INIT, and, if not found, then try LUA_INIT. This is what the patch accomplishes.
I'm using a "dispatcher" file lua_init.lua which is pointed to by LUA_INIT: LUA_INIT=@c:\exe\share\lua\lua_init.lua -- lua_init.lua local v = string.sub(_VERSION, 5, 7) if v == "5.0" then dofile("c:/exe/share/lua/5.0/compat-5.1.lua") else dofile("c:/exe/share/lua/5.1/lua_init.lua") end -- end of lua_init.lua The file which is run via dofile can initialize LUA_PATH, LUA_CPATH or package.path, package.cpathThere is an overhead of running one (small) extra lua file. Other than that, it seems to not restrict me from using 2 versions of Lua simultaneously.
Could you please tell me what's wrong with that approach? -- Shmuel