From 8d706b4ef942e01814f0a9db519aa32505b9abed Mon Sep 17 00:00:00 2001 From: aunsane Date: Fri, 29 Sep 2017 00:22:53 +0300 Subject: MirLua: added service functions to execute lua code version bump --- plugins/MirLua/src/mlua_enviroment.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'plugins/MirLua/src/mlua_enviroment.cpp') 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 -- cgit v1.2.3