diff options
Diffstat (limited to 'plugins/MirLua')
-rw-r--r-- | plugins/MirLua/res/resource.rc | 9 | ||||
-rw-r--r-- | plugins/MirLua/src/m_core.cpp | 57 | ||||
-rw-r--r-- | plugins/MirLua/src/m_genmenu.cpp | 2 | ||||
-rw-r--r-- | plugins/MirLua/src/m_hotkeys.cpp | 4 | ||||
-rw-r--r-- | plugins/MirLua/src/m_icolib.cpp | 4 | ||||
-rw-r--r-- | plugins/MirLua/src/m_schedule.cpp | 21 | ||||
-rw-r--r-- | plugins/MirLua/src/m_sounds.cpp | 8 | ||||
-rw-r--r-- | plugins/MirLua/src/mlua.cpp | 26 | ||||
-rw-r--r-- | plugins/MirLua/src/mlua.h | 3 | ||||
-rw-r--r-- | plugins/MirLua/src/mlua_icons.cpp | 3 | ||||
-rw-r--r-- | plugins/MirLua/src/mlua_options.cpp | 29 | ||||
-rw-r--r-- | plugins/MirLua/src/mlua_script.cpp | 79 | ||||
-rw-r--r-- | plugins/MirLua/src/mlua_script.h | 11 | ||||
-rw-r--r-- | plugins/MirLua/src/resource.h | 8 | ||||
-rw-r--r-- | plugins/MirLua/src/stdafx.h | 2 |
15 files changed, 209 insertions, 57 deletions
diff --git a/plugins/MirLua/res/resource.rc b/plugins/MirLua/res/resource.rc index 017381b5a7..85d91554d8 100644 --- a/plugins/MirLua/res/resource.rc +++ b/plugins/MirLua/res/resource.rc @@ -63,9 +63,10 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL // Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_SCRIPT ICON "script.ico"
-
IDI_OPEN ICON "open.ico"
-
+IDI_RELOAD ICON "reload.ico"
+IDI_FAILED ICON "failed.ico"
+IDI_LOADED ICON "loaded.ico"
/////////////////////////////////////////////////////////////////////////////
//
@@ -109,9 +110,9 @@ END // AFX_DIALOG_LAYOUT
//
-IDD_OPTIONS AFX_DIALOG_LAYOUT
+IDD_OPTIONS AFX_DIALOG_LAYOUT
BEGIN
- 0
+ 0x0000
END
#endif // English resources
diff --git a/plugins/MirLua/src/m_core.cpp b/plugins/MirLua/src/m_core.cpp index a2bb5a820e..c46095ec92 100644 --- a/plugins/MirLua/src/m_core.cpp +++ b/plugins/MirLua/src/m_core.cpp @@ -16,7 +16,7 @@ static int core_CreateHookableEvent(lua_State *L) return 1;
}
-int HookEventObjParam(void *obj, WPARAM wParam, LPARAM lParam, LPARAM param)
+int HookEventLuaStateParam(void *obj, WPARAM wParam, LPARAM lParam, LPARAM param)
{
lua_State *L = (lua_State*)obj;
@@ -38,6 +38,28 @@ int HookEventObjParam(void *obj, WPARAM wParam, LPARAM lParam, LPARAM param) return lua_tointeger(L, 1);
}
+int HookEventScriptParam(void *obj, WPARAM wParam, LPARAM lParam, LPARAM param)
+{
+ CMLuaScript *script = (CMLuaScript*)obj;
+
+ int ref = param;
+ lua_rawgeti(script->L, LUA_REGISTRYINDEX, ref);
+
+ if (wParam)
+ lua_pushlightuserdata(script->L, (void*)wParam);
+ else
+ lua_pushnil(script->L);
+
+ if (lParam)
+ lua_pushlightuserdata(script->L, (void*)lParam);
+ else
+ lua_pushnil(script->L);
+
+ luaM_pcall(script->L, 2, 1);
+
+ return lua_tointeger(script->L, 1);
+}
+
static int core_HookEvent(lua_State *L)
{
const char *name = luaL_checkstring(L, 1);
@@ -46,7 +68,12 @@ static int core_HookEvent(lua_State *L) lua_pushvalue(L, 2);
int ref = luaL_ref(L, LUA_REGISTRYINDEX);
- HANDLE res = ::HookEventObjParam(name, HookEventObjParam, L, ref);
+ HANDLE res = NULL;
+ CMLuaScript *script = CMLuaScript::GetScriptFromEnviroment(L);
+ if (script)
+ res = HookEventObjParam(name, HookEventScriptParam, script, ref);
+ else
+ res = HookEventObjParam(name, HookEventLuaStateParam, L, ref);
if (res == NULL)
{
luaL_unref(L, LUA_REGISTRYINDEX, ref);
@@ -109,7 +136,7 @@ static int core_DestroyHookableEvent(lua_State *L) /***********************************************/
-INT_PTR CreateServiceFunctionObjParam(void *obj, WPARAM wParam, LPARAM lParam, LPARAM param)
+INT_PTR CreateServiceFunctionLuaStateParam(void *obj, WPARAM wParam, LPARAM lParam, LPARAM param)
{
lua_State *L = (lua_State*)obj;
@@ -126,6 +153,23 @@ INT_PTR CreateServiceFunctionObjParam(void *obj, WPARAM wParam, LPARAM lParam, L return res;
}
+INT_PTR CreateServiceFunctionScriptParam(void *obj, WPARAM wParam, LPARAM lParam, LPARAM param)
+{
+ CMLuaScript *script = (CMLuaScript*)obj;
+
+ int ref = param;
+ lua_rawgeti(script->L, LUA_REGISTRYINDEX, ref);
+
+ lua_pushlightuserdata(script->L, (void*)wParam);
+ lua_pushlightuserdata(script->L, (void*)lParam);
+ luaM_pcall(script->L, 2, 1);
+
+ INT_PTR res = lua_tointeger(script->L, 1);
+ lua_pushinteger(script->L, res);
+
+ return res;
+}
+
static int core_CreateServiceFunction(lua_State *L)
{
const char *name = luaL_checkstring(L, 1);
@@ -134,7 +178,12 @@ static int core_CreateServiceFunction(lua_State *L) lua_pushvalue(L, 2);
int ref = luaL_ref(L, LUA_REGISTRYINDEX);
- HANDLE res = ::CreateServiceFunctionObjParam(name, CreateServiceFunctionObjParam, L, ref);
+ HANDLE res = NULL;
+ CMLuaScript *script = CMLuaScript::GetScriptFromEnviroment(L);
+ if (script)
+ res = CreateServiceFunctionObjParam(name, CreateServiceFunctionScriptParam, script, ref);
+ else
+ res = CreateServiceFunctionObjParam(name, CreateServiceFunctionLuaStateParam, L, ref);
if (!res)
{
luaL_unref(L, LUA_REGISTRYINDEX, ref);
diff --git a/plugins/MirLua/src/m_genmenu.cpp b/plugins/MirLua/src/m_genmenu.cpp index b0fbd794a7..21e1533f2a 100644 --- a/plugins/MirLua/src/m_genmenu.cpp +++ b/plugins/MirLua/src/m_genmenu.cpp @@ -2,7 +2,7 @@ void MakeMenuItem(lua_State *L, CMenuItem &mi)
{
- mi.hLangpack = g_mLua->GetHLangpack();
+ mi.hLangpack = CMLuaScript::GetScriptIdFromEnviroment(L);
lua_getfield(L, -1, "Flags");
mi.flags = lua_tointeger(L, -1);
diff --git a/plugins/MirLua/src/m_hotkeys.cpp b/plugins/MirLua/src/m_hotkeys.cpp index 9cd4ad3aa7..b0d1e04d49 100644 --- a/plugins/MirLua/src/m_hotkeys.cpp +++ b/plugins/MirLua/src/m_hotkeys.cpp @@ -47,7 +47,9 @@ static int hotkeys_Register(lua_State *L) HOTKEYDESC hk;
MakeHotkey(L, hk);
- INT_PTR res = ::CallService("CoreHotkeys/Register", (WPARAM)g_mLua->GetHLangpack(), (LPARAM)&hk);
+ int hScriptLangpack = CMLuaScript::GetScriptIdFromEnviroment(L);
+
+ INT_PTR res = ::CallService("CoreHotkeys/Register", (WPARAM)hScriptLangpack, (LPARAM)&hk);
lua_pushboolean(L, res);
return 1;
diff --git a/plugins/MirLua/src/m_icolib.cpp b/plugins/MirLua/src/m_icolib.cpp index de5195341d..019d1ccf25 100644 --- a/plugins/MirLua/src/m_icolib.cpp +++ b/plugins/MirLua/src/m_icolib.cpp @@ -21,7 +21,9 @@ static int icolib_AddIcon(lua_State *L) si.defaultFile.t = filePath;
si.hDefaultIcon = GetIcon(IDI_SCRIPT);
- HANDLE res = IcoLib_AddIcon(&si, g_mLua->GetHLangpack());
+ int hScriptLangpack = CMLuaScript::GetScriptIdFromEnviroment(L);
+
+ HANDLE res = IcoLib_AddIcon(&si, hScriptLangpack);
lua_pushlightuserdata(L, res);
return 1;
diff --git a/plugins/MirLua/src/m_schedule.cpp b/plugins/MirLua/src/m_schedule.cpp index 3ee8b70663..45e961ee2f 100644 --- a/plugins/MirLua/src/m_schedule.cpp +++ b/plugins/MirLua/src/m_schedule.cpp @@ -12,8 +12,8 @@ struct ScheduleTask time_t interval;
lua_State *L;
- int threadRef;
- int callbackRef;
+ //int threadRef;
+ //int callbackRef;
};
static int TaskCompare(const ScheduleTask *p1, const ScheduleTask *p2)
@@ -25,8 +25,12 @@ static LIST<ScheduleTask> tasks(1, TaskCompare); void DestroyTask(ScheduleTask *task)
{
- luaL_unref(task->L, LUA_REGISTRYINDEX, task->callbackRef);
- luaL_unref(task->L, LUA_REGISTRYINDEX, task->threadRef);
+ //luaL_unref(task->L, LUA_REGISTRYINDEX, task->callbackRef);
+ //luaL_unref(task->L, LUA_REGISTRYINDEX, task->threadRef);
+ lua_pushnil(task->L);
+ lua_rawsetp(task->L, LUA_REGISTRYINDEX, task->L);
+ lua_pushnil(task->L);
+ lua_rawsetp(task->L, LUA_REGISTRYINDEX, task);
delete task;
}
@@ -34,7 +38,8 @@ void ExecuteTaskThread(void *arg) {
ScheduleTask *task = (ScheduleTask*)arg;
- lua_rawgeti(task->L, LUA_REGISTRYINDEX, task->callbackRef);
+ //lua_rawgeti(task->L, LUA_REGISTRYINDEX, task->callbackRef);
+ lua_rawgetp(task->L, LUA_REGISTRYINDEX, task->L);
luaM_pcall(task->L, 0, 1);
void* res = lua_touserdata(task->L, -1);
@@ -156,9 +161,11 @@ static int fluent_Do(lua_State *L) task->timestamp = timestamp;
task->interval = interval;
task->L = lua_newthread(L);
- task->threadRef = luaL_ref(L, LUA_REGISTRYINDEX);
+ lua_rawsetp(L, LUA_REGISTRYINDEX, task);
+ //task->threadRef = luaL_ref(L, LUA_REGISTRYINDEX);
lua_pushvalue(L, 1);
- task->callbackRef = luaL_ref(L, LUA_REGISTRYINDEX);
+ //task->callbackRef = luaL_ref(L, LUA_REGISTRYINDEX);
+ lua_rawsetp(L, LUA_REGISTRYINDEX, task->L);
{
mir_cslock lock(threadLock);
tasks.insert(task);
diff --git a/plugins/MirLua/src/m_sounds.cpp b/plugins/MirLua/src/m_sounds.cpp index de2a82c23f..3575ccf546 100644 --- a/plugins/MirLua/src/m_sounds.cpp +++ b/plugins/MirLua/src/m_sounds.cpp @@ -14,7 +14,9 @@ static int lua_AddSound(lua_State *L) ssd.ptszSection = section;
ssd.ptszDefaultFile = filePath;
- INT_PTR res = ::CallService("Skin/Sounds/AddNew", hLangpack, (LPARAM)&ssd);
+ int hScriptLangpack = CMLuaScript::GetScriptIdFromEnviroment(L);
+
+ INT_PTR res = CallService("Skin/Sounds/AddNew", hScriptLangpack, (LPARAM)&ssd);
lua_pushboolean(L, res == 0);
return 1;
@@ -24,7 +26,7 @@ static int lua_PlaySound(lua_State *L) {
const char *name = luaL_checkstring(L, 1);
- INT_PTR res = ::SkinPlaySound(name);
+ INT_PTR res = SkinPlaySound(name);
lua_pushboolean(L, res == 0);
return 1;
@@ -34,7 +36,7 @@ static int lua_PlayFile(lua_State *L) {
ptrT filePath(mir_utf8decodeT(luaL_checkstring(L, 1)));
- INT_PTR res = ::SkinPlaySoundFile(filePath);
+ INT_PTR res = SkinPlaySoundFile(filePath);
lua_pushboolean(L, res == 0);
return 1;
diff --git a/plugins/MirLua/src/mlua.cpp b/plugins/MirLua/src/mlua.cpp index af6404573c..18f2cf5315 100644 --- a/plugins/MirLua/src/mlua.cpp +++ b/plugins/MirLua/src/mlua.cpp @@ -10,8 +10,6 @@ static int CompareScripts(const CMLuaScript* p1, const CMLuaScript* p2) CMLua::CMLua() : L(NULL), Scripts(10, CompareScripts)
{
- MUUID muidLast = MIID_LAST;
- hLangpack = GetPluginLangId(muidLast, 0);
}
CMLua::~CMLua()
@@ -19,11 +17,6 @@ CMLua::~CMLua() Unload();
}
-const int CMLua::GetHLangpack() const
-{
- return hLangpack;
-}
-
void CMLua::SetPaths()
{
TCHAR path[MAX_PATH];
@@ -74,16 +67,17 @@ void CMLua::Unload() delete script;
}
- ::KillModuleScheduleTasks();
- ::KillModuleMBButtons();
- ::KillModuleTTBButton();
+ KillModuleScheduleTasks();
+ KillModuleMBButtons();
+ KillModuleTTBButton();
+
+ KillModuleIcons(hLangpack);
+ KillModuleSounds(hLangpack);
+ KillModuleMenus(hLangpack);
+ KillModuleHotkeys(hLangpack);
- ::KillModuleIcons(hLangpack);
- ::KillModuleSounds(hLangpack);
- ::KillModuleMenus(hLangpack);
- ::KillModuleHotkeys(hLangpack);
- ::KillObjectEventHooks(L);
- ::KillObjectServices(L);
+ KillObjectEventHooks(L);
+ KillObjectServices(L);
lua_close(L);
}
diff --git a/plugins/MirLua/src/mlua.h b/plugins/MirLua/src/mlua.h index f4ae7237ca..f85db956c3 100644 --- a/plugins/MirLua/src/mlua.h +++ b/plugins/MirLua/src/mlua.h @@ -14,7 +14,6 @@ class CMLua {
private:
lua_State *L;
- int hLangpack;
void SetPaths();
@@ -29,8 +28,6 @@ public: CMLua();
~CMLua();
- const int GetHLangpack() const;
-
void Load();
void Unload();
diff --git a/plugins/MirLua/src/mlua_icons.cpp b/plugins/MirLua/src/mlua_icons.cpp index b8da8bce9e..175e5c62e8 100644 --- a/plugins/MirLua/src/mlua_icons.cpp +++ b/plugins/MirLua/src/mlua_icons.cpp @@ -3,7 +3,10 @@ IconItemT Icons[] =
{
{ LPGENT("Script"), "script", IDI_SCRIPT },
+ { LPGENT("Loaded"), "loaded", IDI_LOADED },
+ { LPGENT("Failed"), "failed", IDI_FAILED },
{ LPGENT("Open"), "open", IDI_OPEN },
+ { LPGENT("Reload"), "reload", IDI_RELOAD },
};
void InitIcons()
diff --git a/plugins/MirLua/src/mlua_options.cpp b/plugins/MirLua/src/mlua_options.cpp index da62cef1d1..2303e6ece3 100644 --- a/plugins/MirLua/src/mlua_options.cpp +++ b/plugins/MirLua/src/mlua_options.cpp @@ -61,10 +61,12 @@ void CLuaOptions::LoadScripts() {
CMLuaScript *script = g_mLua->Scripts[i];
TCHAR *fileName = NEWTSTR_ALLOCA(script->GetFileName());
- int iItem = m_scripts.AddItem(fileName, -1, (LPARAM)script);
+ int iIcon = script->GetStatus() == CMLuaScript::Loaded ? 0 : 1;
+ int iItem = m_scripts.AddItem(fileName, iIcon, (LPARAM)script);
if (db_get_b(NULL, MODULE, _T2A(fileName), 1))
m_scripts.SetCheckState(iItem, TRUE);
- m_scripts.SetItem(iItem, 1, TranslateT("Open"), 0);
+ m_scripts.SetItem(iItem, 1, TranslateT("Open"), 2);
+ m_scripts.SetItem(iItem, 2, TranslateT("Reload"), 3);
}
}
@@ -75,15 +77,19 @@ void CLuaOptions::OnInitDialog() m_scripts.SetExtendedListViewStyle(LVS_EX_SUBITEMIMAGES | LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES | LVS_EX_INFOTIP);
HIMAGELIST hImageList = m_scripts.CreateImageList(LVSIL_SMALL);
+ ImageList_AddIcon(hImageList, GetIcon(IDI_LOADED));
+ ImageList_AddIcon(hImageList, GetIcon(IDI_FAILED));
ImageList_AddIcon(hImageList, GetIcon(IDI_OPEN));
+ ImageList_AddIcon(hImageList, GetIcon(IDI_RELOAD));
TCHAR scriptDir[MAX_PATH], relativeScriptDir[MAX_PATH], header[MAX_PATH + 100];
FoldersGetCustomPathT(g_hScriptsFolder, scriptDir, _countof(scriptDir), VARST(MIRLUA_PATHT));
PathToRelativeT(scriptDir, relativeScriptDir, NULL);
mir_sntprintf(header, _T("%s (%s)"), TranslateT("Common scripts"), relativeScriptDir);
- m_scripts.AddColumn(0, _T("Script"), 420);
+ m_scripts.AddColumn(0, _T("Script"), 380);
m_scripts.AddColumn(1, NULL, 32 - GetSystemMetrics(SM_CXVSCROLL));
+ m_scripts.AddColumn(2, NULL, 32 - GetSystemMetrics(SM_CXVSCROLL));
LoadScripts();
@@ -140,8 +146,23 @@ void CLuaOptions::OnScriptListClick(CCtrlListView::TEventInfo *evt) CMLuaScript* script = (CMLuaScript*)lvi.lParam;
- if (lvi.iSubItem == 1)
+ switch (lvi.iSubItem)
+ {
+ case 1:
ShellExecute(m_hwnd, _T("Open"), script->GetFilePath(), NULL, NULL, SW_SHOWNORMAL);
+ break;
+
+ case 2:
+ //m_scripts.DeleteItem(evt->nmlvia->iItem);
+ script->Unload();
+ script->Load();
+ lvi.mask = LVIF_IMAGE;
+ lvi.iSubItem = 0;
+ lvi.iImage = script->GetStatus() == CMLuaScript::Loaded ? 0 : 1;
+ ListView_SetItem(m_scripts.GetHwnd(), &lvi);
+ m_scripts.Update(evt->nmlvia->iItem);
+ break;
+ }
mir_free(lvi.pszText);
}
diff --git a/plugins/MirLua/src/mlua_script.cpp b/plugins/MirLua/src/mlua_script.cpp index 26c4006e2d..6a51046a94 100644 --- a/plugins/MirLua/src/mlua_script.cpp +++ b/plugins/MirLua/src/mlua_script.cpp @@ -1,7 +1,9 @@ #include "stdafx.h"
+#define SCRIPT "Script"
+
CMLuaScript::CMLuaScript(lua_State *L, const TCHAR *path)
- : L(L), status(None), unloadRef(0)
+ : L(L), status(None)
{
mir_tstrcpy(filePath, path);
@@ -14,6 +16,9 @@ CMLuaScript::CMLuaScript(lua_State *L, const TCHAR *path) mir_tstrncpy(name, fileName, length);
moduleName = mir_utf8encodeT(name);
+
+ MUUID muidLast = MIID_LAST;
+ id = GetPluginLangId(muidLast, 0);
}
CMLuaScript::~CMLuaScript()
@@ -21,6 +26,49 @@ CMLuaScript::~CMLuaScript() mir_free(moduleName);
}
+/*const int CMLuaScript::GetId() const
+{
+ return id;
+}*/
+
+CMLuaScript* CMLuaScript::GetScriptFromEnviroment(lua_State *L, int n)
+{
+ CMLuaScript *script = NULL;
+
+ int top = lua_gettop(L);
+
+ lua_Debug ar; + if (lua_getstack(L, 1, &ar) == 0 || lua_getinfo(L, "f", &ar) == 0 || lua_iscfunction(L, -1)) + { + top = lua_gettop(L); + lua_pop(L, 1); + return script;
+ }
+
+ const char *env = lua_getupvalue(L, n, 1); + if (!env || mir_strcmp(env, "_ENV") != 0) + { + top = lua_gettop(L); + lua_pop(L, 1); + return script; + } +
+ lua_getfield(L, -1, SCRIPT);
+ script = (CMLuaScript*)lua_touserdata(L, -1);
+ lua_pop(L, 3);
+
+ return script;
+}
+
+int CMLuaScript::GetScriptIdFromEnviroment(lua_State *L, int n)
+{
+ CMLuaScript *script = GetScriptFromEnviroment(L, n);
+ if (script != NULL)
+ return script->id;
+
+ return hLangpack;
+}
+
const char* CMLuaScript::GetModuleName() const
{
return moduleName;
@@ -43,16 +91,20 @@ const CMLuaScript::Status CMLuaScript::GetStatus() const bool CMLuaScript::Load()
{
+ status = Failed;
+
if (luaL_loadfile(L, T2Utf(filePath)))
{
Log(lua_tostring(L, -1));
return false;
}
- lua_createtable(L, 0, 1);
+ lua_createtable(L, 0, 2);
lua_pushvalue(L, -1);
lua_setfield(L, -2, "_G");
- lua_createtable(L, 0, 1);
+ lua_pushlightuserdata(L, this);
+ lua_setfield(L, -2, "Script");
+ lua_createtable(L, 0, 2);
lua_getglobal(L, "_G");
lua_setfield(L, -2, "__index");
lua_setmetatable(L, -2);
@@ -61,6 +113,8 @@ bool CMLuaScript::Load() if (luaM_pcall(L, 0, 1))
return false;
+ status = Loaded;
+
if (lua_isnoneornil(L, -1))
return true;
@@ -89,7 +143,8 @@ bool CMLuaScript::Load() if (lua_isfunction(L, -1))
{
lua_pushvalue(L, -1);
- unloadRef = luaL_ref(L, LUA_REGISTRYINDEX);
+ lua_rawsetp(L, LUA_REGISTRYINDEX, this);
+ //unloadRef = luaL_ref(L, LUA_REGISTRYINDEX);
}
lua_pop(L, 1);
@@ -100,12 +155,14 @@ bool CMLuaScript::Load() void CMLuaScript::Unload()
{
- if (status == Loaded && unloadRef)
+ if (status == Loaded)
{
- lua_rawgeti(L, LUA_REGISTRYINDEX, unloadRef);
+ lua_rawgetp(L, LUA_REGISTRYINDEX, this);
+ //lua_rawgeti(L, LUA_REGISTRYINDEX, unloadRef);
if (lua_isfunction(L, -1))
luaM_pcall(L);
- luaL_unref(L, LUA_REGISTRYINDEX, unloadRef);
+ lua_pushnil(L);
+ lua_rawsetp(L, LUA_REGISTRYINDEX, this);
status = None;
}
@@ -116,4 +173,12 @@ void CMLuaScript::Unload() lua_pushnil(L);
lua_setglobal(L, moduleName);
+
+ KillModuleIcons(id);
+ KillModuleSounds(id);
+ KillModuleMenus(id);
+ KillModuleHotkeys(id);
+
+ KillObjectEventHooks(this);
+ KillObjectServices(this);
}
\ No newline at end of file diff --git a/plugins/MirLua/src/mlua_script.h b/plugins/MirLua/src/mlua_script.h index 76731395fb..742fc9ac75 100644 --- a/plugins/MirLua/src/mlua_script.h +++ b/plugins/MirLua/src/mlua_script.h @@ -4,6 +4,8 @@ class CMLuaScript
{
public:
+ lua_State *L;
+
enum Status
{
None,
@@ -12,18 +14,21 @@ public: };
private:
- lua_State *L;
-
+ int id;
char *moduleName;
TCHAR *fileName;
TCHAR filePath[MAX_PATH];
Status status;
- int unloadRef;
public:
CMLuaScript(lua_State *L, const TCHAR *path);
~CMLuaScript();
+ //const int GetId() const;
+
+ static CMLuaScript* GetScriptFromEnviroment(lua_State *L, int n = 1);
+ static int GetScriptIdFromEnviroment(lua_State *L, int n = 1);
+
const char* GetModuleName() const;
const TCHAR* GetFilePath() const;
diff --git a/plugins/MirLua/src/resource.h b/plugins/MirLua/src/resource.h index 22507f4637..9ed73fc420 100644 --- a/plugins/MirLua/src/resource.h +++ b/plugins/MirLua/src/resource.h @@ -1,11 +1,15 @@ //{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by E:\Projects\C++\MirandaNG\plugins\MirLua\res\resource.rc
+// Used by D:\Projects\MirandaNG\plugins\MirLua\res\resource.rc
//
#define IDI_ICON 100
#define IDI_SCRIPT 100
#define IDI_OPEN 105
#define IDD_OPTIONS 106
+#define IDI_RELOAD 108
+#define IDI_FAILED 109
+#define IDI_ICON2 110
+#define IDI_LOADED 110
#define IDC_SCRIPTS 1011
#define IDC_RELOAD 1012
#define IDC_POPUPONERROR 1013
@@ -15,7 +19,7 @@ //
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 108
+#define _APS_NEXT_RESOURCE_VALUE 111
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1015
#define _APS_NEXT_SYMED_VALUE 101
diff --git a/plugins/MirLua/src/stdafx.h b/plugins/MirLua/src/stdafx.h index b9431c162e..43d3a21990 100644 --- a/plugins/MirLua/src/stdafx.h +++ b/plugins/MirLua/src/stdafx.h @@ -149,7 +149,7 @@ WPARAM luaM_towparam(lua_State *L, int idx); LPARAM luaM_tolparam(lua_State *L, int idx);
CMLuaScript* GetScriptFromEnviroment(lua_State *L, int n = 1);
-int GetScriptHLangpackFromEnviroment(lua_State *L, int n = 1);
+int GetScriptIdFromEnviroment(lua_State *L, int n = 1);
void InitIcons();
HICON GetIcon(int iconId);
|