diff options
author | aunsane <aunsane@gmail.com> | 2017-09-29 00:22:53 +0300 |
---|---|---|
committer | aunsane <aunsane@gmail.com> | 2017-09-29 00:39:19 +0300 |
commit | 8d706b4ef942e01814f0a9db519aa32505b9abed (patch) | |
tree | ec3cd0464d4862f42041936958595c057abdfb78 /plugins/MirLua/src/mlua_enviroment.cpp | |
parent | af9c3d7de7e35632d046575b5e4809a04abec816 (diff) |
MirLua: added service functions to execute lua code
version bump
Diffstat (limited to 'plugins/MirLua/src/mlua_enviroment.cpp')
-rw-r--r-- | plugins/MirLua/src/mlua_enviroment.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/plugins/MirLua/src/mlua_enviroment.cpp b/plugins/MirLua/src/mlua_enviroment.cpp index 5d3b7cf37c..268afc46b0 100644 --- a/plugins/MirLua/src/mlua_enviroment.cpp +++ b/plugins/MirLua/src/mlua_enviroment.cpp @@ -9,6 +9,17 @@ CMLuaEnviroment::CMLuaEnviroment(lua_State *L) id = GetPluginLangId(muidLast, 0); } +CMLuaEnviroment::~CMLuaEnviroment() +{ + KillModuleIcons(id); + KillModuleSounds(id); + KillModuleMenus(id); + KillModuleHotkeys(id); + + KillObjectEventHooks(this); + KillObjectServices(this); +} + CMLuaEnviroment* CMLuaEnviroment::GetEnviroment(lua_State *L) { if (!luaM_getenv(L)) @@ -49,23 +60,12 @@ void CMLuaEnviroment::CreateEnviromentTable() lua_setmetatable(L, -2); } -bool CMLuaEnviroment::Load(int ind) +bool CMLuaEnviroment::Load() { - luaL_checktype(L, ind, LUA_TFUNCTION); + luaL_checktype(L, -1, LUA_TFUNCTION); CreateEnviromentTable(); lua_setupvalue(L, -2, 1); - return luaM_pcall(L, 0, 1) == LUA_OK; + return lua_pcall(L, 0, 1, 0) == LUA_OK; } - -void CMLuaEnviroment::Unload() -{ - KillModuleIcons(id); - KillModuleSounds(id); - KillModuleMenus(id); - KillModuleHotkeys(id); - - KillObjectEventHooks(this); - KillObjectServices(this); -}
\ No newline at end of file |