| 1059 | } |
| 1060 | |
| 1061 | bool DFHack::Lua::Require(color_ostream &out, lua_State *state, |
| 1062 | const std::string &module, bool setglobal) |
| 1063 | { |
| 1064 | if (!PushModule(out, state, module.c_str())) |
| 1065 | return false; |
| 1066 | |
| 1067 | if (setglobal) |
| 1068 | { |
| 1069 | lua_rawgetp(state, LUA_REGISTRYINDEX, &DFHACK_BASE_G_TOKEN); |
| 1070 | lua_swap(state); |
| 1071 | lua_setfield(state, -2, module.c_str()); |
| 1072 | } |
| 1073 | else |
| 1074 | lua_pop(state, 1); |
| 1075 | |
| 1076 | return true; |
| 1077 | } |
| 1078 | |
| 1079 | static bool doAssignDFObject(color_ostream *out, lua_State *state, |
| 1080 | const type_identity *type, void *target, int val_index, |
nothing calls this directly
no test coverage detected