From b048ea322fac0d6cb59b9f1645fad9d7a898fc57 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sun, 21 Jun 2015 18:40:46 +0000 Subject: MirLua: Scripts reloading pt.2 git-svn-id: http://svn.miranda-ng.org/main/trunk@14304 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirLua/src/mlua.cpp | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) (limited to 'plugins/MirLua/src/mlua.cpp') diff --git a/plugins/MirLua/src/mlua.cpp b/plugins/MirLua/src/mlua.cpp index 5945947441..f9772e0021 100644 --- a/plugins/MirLua/src/mlua.cpp +++ b/plugins/MirLua/src/mlua.cpp @@ -23,39 +23,24 @@ void CMLua::Load() lua_pop(L, 1); LoadMirandaModules(); + + hScriptsLangpack = GetPluginLangId(MIID_LAST, 0); + + CLuaLoader loader(this); + loader.LoadScripts(); } void CMLua::Unload() { if (L) lua_close(L); + KillModuleMenus(hScriptsLangpack); } void CMLua::Reload() { - /*lua_getglobal(L, "m"); - lua_getfield(L, -1, "OnPreShutdown"); - if (lua_isfunction(L, -1)) - { - lua_pushlightuserdata(L, NULL); - lua_pushlightuserdata(L, NULL); - if (lua_pcall(L, 2, 1, 0)) - printf("%s\n", lua_tostring(L, -1)); - } - lua_pop(L, 1);*/ Unload(); - Load(); - /*lua_getglobal(L, "m"); - lua_getfield(L, -1, "OnModulesLoaded"); - if (lua_isfunction(L, -1)) - { - lua_pushlightuserdata(L, NULL); - lua_pushlightuserdata(L, NULL); - if (lua_pcall(L, 2, 1, 0)) - printf("%s\n", lua_tostring(L, -1)); - } - lua_pop(L, 1);*/ } void CMLua::LoadModule(const char *name, lua_CFunction loader) @@ -69,7 +54,7 @@ void CMLua::LoadModule(const char *name, lua_CFunction loader) void CMLua::LoadCoreModule() { luaL_newlib(L, coreLib); - lua_pushlightuserdata(L, NULL); + lua_pushlightuserdata(L, NULL); lua_setfield(L, -2, "NULL"); lua_setglobal(L, "m"); } -- cgit v1.2.3