- // Copy safe IO functions
- lua_getfield(L, old_globals, "io");
- lua_newtable(L);
- copy_safe(L, io_whitelist, sizeof(io_whitelist));
-
- // And replace unsafe ones
- SECURE_API(io, open);
- SECURE_API(io, input);
- SECURE_API(io, output);
- SECURE_API(io, lines);
-
- lua_setglobal(L, "io");
- lua_pop(L, 1); // Pop old IO
-