forked from enlightenment/efl
elua: the -E parameter now works (ignores env vars)
This commit is contained in:
parent
473549219e
commit
c12b55696d
|
@ -125,16 +125,17 @@ static int register_require(lua_State *L) {
|
|||
const char *corepath = lua_touserdata(L, lua_upvalueindex(1));
|
||||
const char *modpath = lua_touserdata(L, lua_upvalueindex(2));
|
||||
Eina_List *largs = lua_touserdata(L, lua_upvalueindex(3)), *l = NULL;
|
||||
Eina_Bool noenv = lua_toboolean (L, lua_upvalueindex(4));
|
||||
Arg_Data *data = NULL;
|
||||
int n = 2;
|
||||
lua_pushvalue(L, 1);
|
||||
require_ref = luaL_ref(L, LUA_REGISTRYINDEX);
|
||||
if (!corepath) {
|
||||
if (!(corepath = getenv("ELUA_CORE_DIR")) || !corepath[0])
|
||||
if (noenv || !(corepath = getenv("ELUA_CORE_DIR")) || !corepath[0])
|
||||
corepath = ELUA_CORE_DIR;
|
||||
}
|
||||
if (!modpath) {
|
||||
if (!(modpath = getenv("ELUA_MODULES_DIR")) || !modpath[0])
|
||||
if (noenv || !(modpath = getenv("ELUA_MODULES_DIR")) || !modpath[0])
|
||||
modpath = ELUA_MODULES_DIR;
|
||||
}
|
||||
lua_pushfstring(L, "%s/?.lua;", corepath);
|
||||
|
@ -276,6 +277,7 @@ static int lua_main(lua_State *L) {
|
|||
lua_pushlightuserdata(L, coredir);
|
||||
lua_pushlightuserdata(L, moddir);
|
||||
lua_pushlightuserdata(L, largs);
|
||||
lua_pushboolean (L, noenv);
|
||||
lua_pushcclosure(L, register_require, 3);
|
||||
lua_createtable(L, 0, 0);
|
||||
luaL_register(L, NULL, cutillib);
|
||||
|
|
Loading…
Reference in New Issue