-- Lua 5.0/5.1 init file for Kepler -- -- Prepares the paths for Lua and C modules using three parameters: -- conf - configuration files (optional, checked before the Lua modules) -- luabase - Lua modules -- libbase - C modules -- -- (the paths should end in /) -- -- Defines the default web directory for Lua Pages and Lua Scripts -- -- $Id: t_kepler_init.lua,v 1.4 2006/08/21 14:34:48 mascarenhas Exp $ -- Lua 5.0 paths local conf50 = [[/local/web/kepler/conf]] local luabase50 = [[/share/lua/5.1]] local libbase50 = [[/lib/lua/5.1]] -- Lua 5.1 paths local conf51 = [[local/web/kepler/conf]] local luabase51 = [[/share/lua/5.1]] local libbase51 = [[/lib/lua/5.1]] -- Library extension used in the system (dll, so etc) local libext = [[so]] -- Xavante default web directory XAVANTE_WEB = [[local/web/kepler/web]] --------- end of parameters ------------ local function expandPath(base, conf) local path = "" if conf and conf ~= "" then path = path..conf..[[/?.lua;]] end path = path..base..[[/?.lua;]]..base..[[/?/?.lua;]]..base..[[/?/init.lua]] return path end local function expandCPath(base) return base..[[/?.]]..libext..[[;]]..base..[[/l?.]]..libext..[[;]]..base..[[/?/l?.]]..libext end if string.find (_VERSION, "Lua 5.0") then LUA_PATH = LUA_PATH or os.getenv("LUA_PATH") or expandPath(luabase50, conf50) if not _COMPAT51 then require"compat-5.1" end package.cpath = expandCPath(libbase50) elseif string.find (_VERSION, "Lua 5.1") then package.path = expandPath(conf51, luabase51) package.cpath = expandCPath(libbase51) else error("This init file works only with Lua 5.0 or Lua 5.1") end