Merge pull request #2583 from arekatir/develop

Remove os.execute and io.popen
develop
Myk 2023-01-09 23:53:32 -08:00 committed by GitHub
commit 17bcdb1f56
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