summaryrefslogtreecommitdiff
path: root/plugins/MirLua/src/mlua_module_loader.cpp
diff options
context:
space:
mode:
authoraunsane <aunsane@gmail.com>2018-03-21 01:28:14 +0300
committeraunsane <aunsane@gmail.com>2018-03-21 01:28:26 +0300
commitb987b7a8e5a78ff3cd63da062917b1c5fce91cc2 (patch)
treea34569e27dc149310ff4f95e6a93ad387de359e5 /plugins/MirLua/src/mlua_module_loader.cpp
parent165d7791631a9c9ed0998c90b696116593ebfd70 (diff)
MurLua: various fixes
- fixed script reloading - fixed string interpolation - hook and service refs moved to Enviroment - removed RegisterProtocol from m_protocols - code cleanup - version bump
Diffstat (limited to 'plugins/MirLua/src/mlua_module_loader.cpp')
-rw-r--r--plugins/MirLua/src/mlua_module_loader.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/plugins/MirLua/src/mlua_module_loader.cpp b/plugins/MirLua/src/mlua_module_loader.cpp
index c28e6edaeb..d914bad120 100644
--- a/plugins/MirLua/src/mlua_module_loader.cpp
+++ b/plugins/MirLua/src/mlua_module_loader.cpp
@@ -6,17 +6,12 @@ CMLuaModuleLoader::CMLuaModuleLoader(lua_State *L) : L(L)
void CMLuaModuleLoader::Load(const char *name, lua_CFunction loader)
{
- luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED");
- lua_pushcfunction(L, loader);
- lua_pushstring(L, name);
- luaM_pcall(L, 1, 1);
- lua_setfield(L, -2, name);
- lua_pop(L, 1);
+ luaL_requiref(L, name, loader, 0);
}
void CMLuaModuleLoader::Preload(const char *name, lua_CFunction loader)
{
- luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD");
+ luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE);
lua_pushcfunction(L, loader);
lua_setfield(L, -2, name);
lua_pop(L, 1);