| 86 | } |
| 87 | |
| 88 | static int LoadModule(lua_State *L) { |
| 89 | int top = lua_gettop(L); |
| 90 | (void) top; |
| 91 | |
| 92 | HContext context = dmScript::GetScriptContext(L); |
| 93 | |
| 94 | const char *name = luaL_checkstring(L, 1); |
| 95 | dmhash_t name_hash = dmHashString64(name); |
| 96 | Module* module = context->m_Modules.Get(name_hash); |
| 97 | |
| 98 | if (module == NULL) |
| 99 | { |
| 100 | lua_pushfstring(L, "\n\tno file '%s'", name); |
| 101 | assert(top + 1 == lua_gettop(L)); |
| 102 | return 1; |
| 103 | } |
| 104 | |
| 105 | if (!LuaLoadModule(L, module->m_Script, module->m_ScriptSize, module->m_Filename)) |
| 106 | { |
| 107 | luaL_error(L, "error loading module '%s'from file '%s':\n\t%s", |
| 108 | lua_tostring(L, 1), name, lua_tostring(L, -1)); |
| 109 | } |
| 110 | assert(top + 1 == lua_gettop(L)); |
| 111 | return 1; |
| 112 | } |
| 113 | |
| 114 | Result AddModule(HContext context, dmLuaDDF::LuaSource *source, const char *script_name, void* resource, dmhash_t path_hash) |
| 115 | { |
nothing calls this directly
no test coverage detected