diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2016-01-07 13:17:33 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2016-01-07 13:17:33 +0000 |
commit | 2826ce96c351ae3d5fc7dea6b4bc60e92b23e550 (patch) | |
tree | 2a6ae22de1c6107e5a3fe52f4dd1de2001c78afc /plugins/MirLua/src/mlua_script.cpp | |
parent | 8a22b1b13cbd23e4d0a0a1cf3da9c84596b55280 (diff) |
MirLua: fixed module loading
git-svn-id: http://svn.miranda-ng.org/main/trunk@16046 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/src/mlua_script.cpp')
-rw-r--r-- | plugins/MirLua/src/mlua_script.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/plugins/MirLua/src/mlua_script.cpp b/plugins/MirLua/src/mlua_script.cpp index 3d99429ec2..ae44fc4e6e 100644 --- a/plugins/MirLua/src/mlua_script.cpp +++ b/plugins/MirLua/src/mlua_script.cpp @@ -8,7 +8,7 @@ CMLuaScript::CMLuaScript(lua_State *L, const TCHAR *path) fileName = _tcsrchr(filePath, '\\') + 1;
TCHAR *dot = _tcsrchr(fileName, '.');
- size_t length = mir_tstrlen(fileName) - mir_tstrlen(dot);
+ size_t length = mir_tstrlen(fileName) - mir_tstrlen(dot) + 1;
ptrT name((TCHAR*)mir_calloc(sizeof(TCHAR) * (length + 1)));
mir_tstrncpy(name, fileName, length);
@@ -57,12 +57,13 @@ bool CMLuaScript::Load() luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED");
lua_getfield(L, -1, moduleName);
- if (lua_toboolean(L, -1))
- Log("Module %s will be replaced with new one");
- lua_pop(L, 1);
- lua_pushvalue(L, -2);
- lua_setfield(L, -2, moduleName);
- lua_pop(L, 1);
+ if (!lua_toboolean(L, -1))
+ {
+ lua_pop(L, 1);
+ lua_pushvalue(L, -2);
+ lua_setfield(L, -2, moduleName);
+ }
+ lua_remove(L, -2);
if (!lua_istable(L, -1))
return true;
|