}
static Eina_File *
-open_src(const char *fname, const char *mode, Eina_Bool *bc)
+open_src(const char *fname, Eina_Bool *bc)
{
Eina_File *f = NULL;
const char *ext = strstr(fname, ".lua");
- if (ext && !ext[4] && (!mode || strchr(mode, 't')))
+ if (ext && !ext[4])
{
char buf[PATH_MAX];
snprintf(buf, sizeof(buf), "%sc", fname);
}
static int
-elua_loadstdin(lua_State *L, const char *mode)
+elua_loadstdin(lua_State *L)
{
char buff[LUAL_BUFFERSIZE];
- int status = lua_loadx(L, getf, &buff, "=stdin", mode);
+ int status = lua_load(L, getf, &buff, "=stdin");
if (ferror(stdin))
{
lua_pop(L, 1);
}
int
-elua_loadfilex(lua_State *L, const char *fname, const char *mode)
+elua_loadfile(lua_State *L, const char *fname)
{
Map_Stream s;
int status;
Eina_Bool bcache = EINA_FALSE;
if (!fname)
{
- return elua_loadstdin(L, mode);
+ return elua_loadstdin(L);
}
- if (!(f = open_src(fname, mode, &bcache)))
+ if (!(f = open_src(fname, &bcache)))
{
lua_pushfstring(L, "cannot open %s: %s", fname, strerror(errno));
return LUA_ERRFILE;
lua_remove(L, -2);
return LUA_ERRFILE;
}
- status = lua_loadx(L, getf_map, &s, chname, mode);
+ status = lua_load(L, getf_map, &s, chname);
eina_file_map_free(f, s.fmap);
eina_file_close(f);
if (!status && bcache) write_bc(L, fname);
return status;
}
-int
-elua_loadfile(lua_State *L, const char *fname)
-{
- return elua_loadfilex(L, fname, NULL);
-}
-
/* lua function */
static int
loadfile(lua_State *L)
{
const char *fname = luaL_optstring(L, 1, NULL);
- const char *mode = luaL_optstring(L, 2, NULL);
- int status = elua_loadfilex(L, fname, mode),
+ int status = elua_loadfile(L, fname),
hasenv = (lua_gettop(L) >= 3);
if (!status)
{