Remove os.execute and io.popen

develop
arekatir 2023-01-09 23:04:43 -05:00 committed by GitHub
parent 3938721df0
commit d725b813c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

@ -1896,9 +1896,17 @@ lua_State *DFHack::Lua::Open(color_ostream &out, lua_State *state)
luaL_setfuncs(state, dfhack_coro_funcs, 0);
lua_pop(state, 1);
// replace some io functions
lua_getglobal(state, "io");
lua_pushnil(state);
lua_setfield(state, -2, "popen");
lua_pop(state, 1);
// replace some os functions
lua_getglobal(state, "os");
luaL_setfuncs(state, dfhack_os_funcs, 0);
lua_pushnil(state);
lua_setfield(state, -2, "execute");
lua_pop(state, 1);
// split the global environment