| 1019 | } |
| 1020 | |
| 1021 | bool DFHack::Lua::PushModule(color_ostream &out, lua_State *state, const char *module) |
| 1022 | { |
| 1023 | AssertCoreSuspend(state); |
| 1024 | |
| 1025 | // Check if it is already loaded |
| 1026 | lua_rawgetp(state, LUA_REGISTRYINDEX, &DFHACK_LOADED_TOKEN); |
| 1027 | lua_pushstring(state, module); |
| 1028 | lua_rawget(state, -2); |
| 1029 | |
| 1030 | if (lua_toboolean(state, -1)) |
| 1031 | { |
| 1032 | lua_remove(state, -2); |
| 1033 | return true; |
| 1034 | } |
| 1035 | |
| 1036 | lua_pop(state, 2); |
| 1037 | lua_rawgetp(state, LUA_REGISTRYINDEX, &DFHACK_REQUIRE_TOKEN); |
| 1038 | lua_pushstring(state, module); |
| 1039 | |
| 1040 | return Lua::SafeCall(out, state, 1, 1); |
| 1041 | } |
| 1042 | |
| 1043 | bool DFHack::Lua::PushModulePublic(color_ostream &out, lua_State *state, |
| 1044 | const char *module, const char *name) |
nothing calls this directly
no test coverage detected