| 231 | } |
| 232 | |
| 233 | void lua_scripts::create_sandbox(lua_State *L) { |
| 234 | lua_newtable(L); |
| 235 | luaopen_base_sandbox(L); |
| 236 | |
| 237 | #if ENABLE_DEBUG_MODULE |
| 238 | lua_pushstring(L, "debug"); |
| 239 | luaopen_debug(L); |
| 240 | lua_settable(L, -3); |
| 241 | #endif |
| 242 | lua_pushstring(L, "math"); |
| 243 | luaopen_math(L); |
| 244 | lua_settable(L, -3); |
| 245 | lua_pushstring(L, "table"); |
| 246 | luaopen_table(L); |
| 247 | lua_settable(L, -3); |
| 248 | lua_pushstring(L, "string"); |
| 249 | luaopen_string(L); |
| 250 | lua_settable(L, -3); |
| 251 | lua_pushstring(L, "io"); |
| 252 | luaopen_io(L); |
| 253 | lua_settable(L, -3); |
| 254 | lua_pushstring(L, "utf8"); |
| 255 | luaopen_utf8(L); |
| 256 | lua_settable(L, -3); |
| 257 | lua_pushstring(L, "package"); |
| 258 | luaopen_package(L); |
| 259 | lua_settable(L, -3); |
| 260 | |
| 261 | load_generated_sandbox(L); |
| 262 | } |
| 263 | |
| 264 | void lua_scripts::load_all_scripts_in_dir(lua_State *L, const char *dirname) { |
| 265 | if (dirname == nullptr) { |
nothing calls this directly
no test coverage detected