diff options
-rw-r--r-- | plugins/MirLua/src/m_genmenu.cpp | 21 | ||||
-rw-r--r-- | plugins/MirLua/src/m_hotkeys.cpp | 21 | ||||
-rw-r--r-- | plugins/MirLua/src/m_msg_buttonsbar.cpp | 15 | ||||
-rw-r--r-- | plugins/MirLua/src/m_popup.cpp | 45 | ||||
-rw-r--r-- | plugins/MirLua/src/m_schedule.cpp | 84 | ||||
-rw-r--r-- | plugins/MirLua/src/m_toptoolbar.cpp | 33 | ||||
-rw-r--r-- | plugins/MirLua/src/mlua_metatable.h | 2 | ||||
-rw-r--r-- | plugins/MirLua/src/mlua_script.cpp | 6 | ||||
-rw-r--r-- | plugins/MirLua/src/mlua_utils.cpp | 14 | ||||
-rw-r--r-- | plugins/MirLua/src/stdafx.h | 4 |
10 files changed, 80 insertions, 165 deletions
diff --git a/plugins/MirLua/src/m_genmenu.cpp b/plugins/MirLua/src/m_genmenu.cpp index 8bad0c23c9..8ec5baa7a3 100644 --- a/plugins/MirLua/src/m_genmenu.cpp +++ b/plugins/MirLua/src/m_genmenu.cpp @@ -4,43 +4,36 @@ void MakeMenuItem(lua_State *L, CMenuItem &mi) {
mi.hLangpack = hScriptsLangpack;
- lua_pushliteral(L, "Flags");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Flags");
mi.flags = lua_tointeger(L, -1);
lua_pop(L, 1);
if (!(mi.flags & CMIF_TCHAR))
mi.flags |= CMIF_TCHAR;
- lua_pushliteral(L, "Uid");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Uid");
const char* uuid = (char*)lua_tostring(L, -1);
if (UuidFromStringA((RPC_CSTR)uuid, (UUID*)&mi.uid))
UNSET_UID(mi);
lua_pop(L, 1);
- lua_pushliteral(L, "Name");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Name");
mi.name.t = mir_utf8decodeT((char*)luaL_checkstring(L, -1));
lua_pop(L, 1);
- lua_pushliteral(L, "Position");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Position");
mi.position = lua_tointeger(L, -1);
lua_pop(L, 1);
- lua_pushliteral(L, "Icon");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Icon");
mi.hIcolibItem = (HANDLE)lua_touserdata(L, -1);
lua_pop(L, 1);
- lua_pushliteral(L, "Service");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Service");
mi.pszService = (char*)lua_tostring(L, -1);
lua_pop(L, 1);
- lua_pushliteral(L, "Parent");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Parent");
mi.root = (HGENMENU)lua_touserdata(L, -1);
lua_pop(L, 1);
}
diff --git a/plugins/MirLua/src/m_hotkeys.cpp b/plugins/MirLua/src/m_hotkeys.cpp index 2c71f28273..a5ff2c4e34 100644 --- a/plugins/MirLua/src/m_hotkeys.cpp +++ b/plugins/MirLua/src/m_hotkeys.cpp @@ -4,41 +4,34 @@ void MakeHotkey(lua_State *L, HOTKEYDESC &hk) {
hk.cbSize = sizeof(HOTKEYDESC);
- lua_pushliteral(L, "Flags");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Flags");
hk.dwFlags = lua_tointeger(L, -1);
lua_pop(L, 1);
if (!(hk.dwFlags & HKD_TCHAR))
hk.dwFlags |= HKD_TCHAR;
- lua_pushliteral(L, "Name");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Name");
hk.pszName = mir_utf8decodeA(luaL_checkstring(L, -1));
lua_pop(L, 1);
- lua_pushliteral(L, "Description");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Description");
hk.ptszDescription = mir_utf8decodeT((char*)lua_tostring(L, -1));
lua_pop(L, 1);
- lua_pushliteral(L, "Section");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Section");
hk.ptszSection = mir_utf8decodeT(luaL_optstring(L, -1, MODULE));
lua_pop(L, 1);
- lua_pushliteral(L, "Hotkey");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Hotkey");
hk.DefHotKey = lua_tointeger(L, -1);
lua_pop(L, 1);
- lua_pushliteral(L, "Service");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Service");
hk.pszService = mir_utf8decodeA(luaL_checkstring(L, -1));
lua_pop(L, 1);
- lua_pushliteral(L, "lParam");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "lParam");
hk.lParam = (LPARAM)lua_touserdata(L, -1);
lua_pop(L, 1);
}
diff --git a/plugins/MirLua/src/m_msg_buttonsbar.cpp b/plugins/MirLua/src/m_msg_buttonsbar.cpp index 103b0d6624..39fff188a1 100644 --- a/plugins/MirLua/src/m_msg_buttonsbar.cpp +++ b/plugins/MirLua/src/m_msg_buttonsbar.cpp @@ -28,31 +28,26 @@ static BBButton* MakeBBButton(lua_State *L) bbb->cbSize = sizeof(BBButton);
bbb->dwDefPos = 100;
- lua_pushliteral(L, "Module");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Module");
bbb->pszModuleName = mir_utf8decodeA(luaL_checkstring(L, -1));
lua_pop(L, 1);
- lua_pushliteral(L, "ButtonID");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "ButtonID");
bbb->dwButtonID = luaL_checkinteger(L, -1);
lua_pop(L, 1);
- lua_pushliteral(L, "Flags");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Flags");
bbb->bbbFlags = lua_tointeger(L, -1);
lua_pop(L, 1);
if ((bbb->bbbFlags & BBBF_ANSITOOLTIP))
bbb->bbbFlags &= ~BBBF_ANSITOOLTIP;
- lua_pushliteral(L, "Tooltip");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Tooltip");
bbb->ptszTooltip = mir_utf8decodeT(lua_tostring(L, -1));
lua_pop(L, 1);
- lua_pushliteral(L, "Icon");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Icon");
bbb->hIcon = (HANDLE)lua_touserdata(L, -1);
lua_pop(L, 1);
diff --git a/plugins/MirLua/src/m_popup.cpp b/plugins/MirLua/src/m_popup.cpp index 2127f70f5f..c99ea7c146 100644 --- a/plugins/MirLua/src/m_popup.cpp +++ b/plugins/MirLua/src/m_popup.cpp @@ -4,33 +4,27 @@ static POPUPDATAT* MakePopupData(lua_State *L) {
POPUPDATAT *ppd = (POPUPDATAT*)mir_calloc(sizeof(POPUPDATAT));
- lua_pushliteral(L, "ContactName");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "ContactName");
mir_tstrcpy(ppd->lptzContactName, ptrT(mir_utf8decodeT(lua_tostring(L, -1))));
lua_pop(L, 1);
- lua_pushliteral(L, "Text");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Text");
mir_tstrcpy(ppd->lptzText, ptrT(mir_utf8decodeT(luaL_checkstring(L, -1))));
lua_pop(L, 1);
- lua_pushliteral(L, "hContact");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "hContact");
ppd->lchContact = lua_tointeger(L, -1);
lua_pop(L, 1);
- lua_pushliteral(L, "ColorBack");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "ColorBack");
ppd->colorBack = lua_tonumber(L, -1);
lua_pop(L, 1);
- lua_pushliteral(L, "ColorText");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "ColorText");
ppd->colorText = lua_tonumber(L, -1);
lua_pop(L, 1);
- lua_pushliteral(L, "Seconds");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Seconds");
ppd->iSeconds = lua_tointeger(L, -1);
lua_pop(L, 1);
@@ -58,51 +52,42 @@ static POPUPDATA2* MakePopupData2(lua_State *L) POPUPDATA2 *ppd = (POPUPDATA2*)mir_calloc(sizeof(POPUPDATA2));
ppd->cbSize = sizeof(POPUPDATA2);
- lua_pushliteral(L, "Flags");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Flags");
ppd->flags = lua_tointeger(L, -1);
lua_pop(L, 1);
if (!(ppd->flags & PU2_TCHAR))
ppd->flags |= PU2_TCHAR;
- lua_pushliteral(L, "Title");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Title");
ppd->lptzTitle = mir_utf8decodeT(lua_tostring(L, -1));
lua_pop(L, 1);
- lua_pushliteral(L, "Text");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Text");
ppd->lptzText = mir_utf8decodeT(luaL_checkstring(L, -1));
lua_pop(L, 1);
- lua_pushliteral(L, "hContact");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "hContact");
ppd->lchContact = lua_tointeger(L, -1);
lua_pop(L, 1);
- lua_pushliteral(L, "ColorBack");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "ColorBack");
ppd->colorBack = lua_tonumber(L, -1);
lua_pop(L, 1);
- lua_pushliteral(L, "ColorText");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "ColorText");
ppd->colorText = lua_tonumber(L, -1);
lua_pop(L, 1);
- lua_pushliteral(L, "hEvent");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "hEvent");
ppd->lchEvent = lua_touserdata(L, -1);
lua_pop(L, 1);
- lua_pushliteral(L, "Timestamp");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Timestamp");
ppd->dwTimestamp = lua_tonumber(L, -1);
lua_pop(L, 1);
- lua_pushliteral(L, "Timeout");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Timeout");
ppd->iSeconds = lua_tointeger(L, -1);
lua_pop(L, 1);
diff --git a/plugins/MirLua/src/m_schedule.cpp b/plugins/MirLua/src/m_schedule.cpp index e79d0932c1..532e8f67e6 100644 --- a/plugins/MirLua/src/m_schedule.cpp +++ b/plugins/MirLua/src/m_schedule.cpp @@ -11,8 +11,6 @@ struct ScheduleTask time_t interval;
lua_State *L;
- //lua_State *T;
- //int threadRef;
int callbackRef;
};
@@ -25,7 +23,6 @@ static LIST<ScheduleTask> tasks(1, TaskCompare); void DestroyTask(ScheduleTask *task)
{
- //luaL_unref(task->L, LUA_REGISTRYINDEX, task->threadRef);
delete task;
}
@@ -161,8 +158,7 @@ static int lua__Seconds(lua_State *L) {
luaL_checktype(L, 1, LUA_TTABLE);
- lua_pushliteral(L, "Interval");
- lua_gettable(L, -2);
+ lua_getfield(L, 1, "Interval");
int seconds = luaL_optinteger(L, -1, 1);
lua_pop(L, 1);
lua_pushinteger(L, seconds);
@@ -189,8 +185,7 @@ static int lua__Minutes(lua_State *L) {
luaL_checktype(L, 1, LUA_TTABLE);
- lua_pushliteral(L, "Interval");
- lua_gettable(L, -2);
+ lua_getfield(L, 1, "Interval");
int interval = luaL_optinteger(L, -1, 1);
lua_pop(L, 1);
lua_pushinteger(L, interval * 60);
@@ -217,8 +212,7 @@ static int lua__Hours(lua_State *L) {
luaL_checktype(L, 1, LUA_TTABLE);
- lua_pushliteral(L, "Interval");
- lua_gettable(L, -2);
+ lua_getfield(L, 1, "Interval");
int interval = luaL_optinteger(L, -1, 1);
lua_pop(L, 1);
lua_pushinteger(L, interval * 60 * 60);
@@ -245,8 +239,7 @@ static int lua__Days(lua_State *L) {
luaL_checktype(L, 1, LUA_TTABLE);
- lua_pushliteral(L, "Interval");
- lua_gettable(L, -2);
+ lua_getfield(L, 1, "Interval");
int interval = luaL_optinteger(L, -1, 1);
lua_pop(L, 1);
lua_pushinteger(L, interval * 60 * 60 * 24);
@@ -273,8 +266,7 @@ static int lua__Weeks(lua_State *L) {
luaL_checktype(L, 1, LUA_TTABLE);
- lua_pushliteral(L, "Interval");
- lua_gettable(L, -2);
+ lua_getfield(L, 1, "Interval");
int interval = luaL_optinteger(L, -1, 1);
lua_pop(L, 1);
lua_pushinteger(L, interval * 60 * 60 * 24 * 7);
@@ -378,8 +370,7 @@ static int lua__From(lua_State *L) if (startTime < timestamp)
{
- lua_pushliteral(L, "Interval");
- lua_gettable(L, 1);
+ lua_getfield(L, 1, "Interval");
int interval = luaL_optinteger(L, -1, 1);
lua_pop(L, 1);
if (interval > 0)
@@ -411,23 +402,20 @@ static int lua__Do(lua_State *L) luaL_checktype(L, 1, LUA_TTABLE);
luaL_checktype(L, 2, LUA_TFUNCTION);
- lua_pushliteral(L, "Interval");
- lua_gettable(L, 1);
+ lua_getfield(L, 1, "Interval");
int interval = luaL_optinteger(L, -1, 0);
lua_pop(L, 1);
time_t timestamp = time(NULL);
- lua_pushliteral(L, "StartTime");
- lua_gettable(L, 1);
+ lua_getfield(L, 1, "StartTime");
time_t startTime = luaL_optinteger(L, -1, timestamp);
lua_pop(L, 1);
if (startTime < timestamp && interval == 0)
return 0;
- lua_pushliteral(L, "DayOfWeek");
- lua_gettable(L, 1);
+ lua_getfield(L, 1, "DayOfWeek");
DayOfWeek dayOfWeek = (DayOfWeek)luaL_optinteger(L, -1, DayOfWeek::None);
lua_pop(L, 1);
@@ -438,8 +426,7 @@ static int lua__Do(lua_State *L) startTime = mktime(ti);
}
- lua_pushliteral(L, "EndTime");
- lua_gettable(L, 1);
+ lua_getfield(L, 1, "EndTime");
time_t endTime = luaL_optinteger(L, -1, 0);
lua_pop(L, 1);
@@ -453,8 +440,6 @@ static int lua__Do(lua_State *L) task->L = L;
lua_pushvalue(L, 2);
task->callbackRef = luaL_ref(L, LUA_REGISTRYINDEX);
- //task->T = lua_newthread(L);
- //task->threadRef = luaL_ref(L, LUA_REGISTRYINDEX);
{
mir_cslock lock(threadLock);
tasks.insert(task);
@@ -464,17 +449,6 @@ static int lua__Do(lua_State *L) return 0;
}
-static int lua__index(lua_State *L)
-{
- int t1 = lua_type(L, 1);
- int t2 = lua_type(L, 2);
-
- //lua_pushvalue(L, 1);
- lua_getmetatable(L, 1);
-
- return 1;
-}
-
static const luaL_Reg scheduleMeta[] =
{
{ "Second", lua__Second },
@@ -498,28 +472,29 @@ static const luaL_Reg scheduleMeta[] = { "Until", lua__Until },
{ "Do", lua__Do },
- //{ "__index", lua__index },
-
{ NULL, NULL }
};
/***********************************************/
-#define MT_SCHEDULETASK "SCHEDULETASK"
-
static int lua__At(lua_State *L)
{
time_t timestamp = time(NULL);
time_t startTime = luaM_opttimestamp(L, 1, timestamp);
lua_newtable(L);
- lua_pushcclosure(L, lua__Until, 0);
- lua_setfield(L, -2, "Until");
- lua_pushcclosure(L, lua__Do, 0);
- lua_setfield(L, -2, "Do");
lua_pushinteger(L, startTime);
lua_setfield(L, -2, "StartTime");
+ lua_newtable(L);
+ lua_pushvalue(L, -1);
+ lua_setfield(L, -2, "__index");
+ lua_pushcfunction(L, lua__Until);
+ lua_setfield(L, -2, "Until");
+ lua_pushcfunction(L, lua__Do);
+ lua_setfield(L, -2, "Do");
+ lua_setmetatable(L, -2);
+
return 1;
}
@@ -527,21 +502,16 @@ static int lua__Every(lua_State *L) {
int interval = luaL_optinteger(L, 1, 0);
- int top = lua_gettop(L);
- luaL_newlib(L, scheduleMeta);
- //lua_newtable(L);
+ lua_newtable(L);
lua_pushinteger(L, interval);
lua_setfield(L, -2, "Interval");
- top = lua_gettop(L);
- lua_createtable(L, 0, 1);
- //lua_pushcfunction(L, lua__index);
- lua_pushvalue(L, -2);
+ lua_newtable(L);
+ lua_pushvalue(L, -1);
lua_setfield(L, -2, "__index");
+ luaL_setfuncs(L, scheduleMeta, 0);
lua_setmetatable(L, -2);
- top = lua_gettop(L);
-
- //luaL_setmetatable(L, MT_SCHEDULETASK);
+ lua_getmetatable(L, -1);
return 1;
}
@@ -559,12 +529,6 @@ LUAMOD_API int luaopen_m_schedule(lua_State *L) {
luaL_newlib(L, scheduleApi);
- //luaL_newmetatable(L, MT_SCHEDULETASK);
- /*lua_pushvalue(L, -1);
- lua_setfield(L, -2, "__index");*/
- //luaL_setfuncs(L, scheduleMeta, 0);
- //lua_pop(L, 1);
-
if (hScheduleEvent == NULL)
hScheduleEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
diff --git a/plugins/MirLua/src/m_toptoolbar.cpp b/plugins/MirLua/src/m_toptoolbar.cpp index f53f728774..310243e734 100644 --- a/plugins/MirLua/src/m_toptoolbar.cpp +++ b/plugins/MirLua/src/m_toptoolbar.cpp @@ -17,60 +17,49 @@ static TTBButton* MakeTBButton(lua_State *L) TTBButton *tbb = (TTBButton*)mir_calloc(sizeof(TTBButton));
tbb->dwFlags = TTBBF_ISLBUTTON;
- lua_pushliteral(L, "Name");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Name");
tbb->name = mir_utf8decodeA(luaL_checkstring(L, -1));
lua_pop(L, 1);
- lua_pushliteral(L, "Service");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Service");
tbb->pszService = (char*)lua_tostring(L, -1);
lua_pop(L, 1);
- lua_pushliteral(L, "Flags");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Flags");
tbb->dwFlags = lua_tointeger(L, -1);
lua_pop(L, 1);
// up state
- lua_pushliteral(L, "IconUp");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "IconUp");
tbb->hIconHandleUp = (HANDLE)lua_touserdata(L, -1);
lua_pop(L, 1);
- lua_pushliteral(L, "TooltipUp");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "TooltipUp");
tbb->pszTooltipUp = mir_utf8decodeA(lua_tostring(L, -1));
lua_pop(L, 1);
- lua_pushliteral(L, "wParamUp");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "wParamUp");
tbb->wParamUp = luaM_towparam(L, -1);
lua_pop(L, 1);
- lua_pushliteral(L, "lParamUp");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "lParamUp");
tbb->lParamUp = luaM_tolparam(L, -1);
lua_pop(L, 1);
// dn state
- lua_pushliteral(L, "IconDown");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "IconDown");
tbb->hIconHandleDn = (HANDLE)lua_touserdata(L, -1);
lua_pop(L, 1);
- lua_pushliteral(L, "TooltipDown");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "TooltipDown");
tbb->pszTooltipDn = mir_utf8decodeA(lua_tostring(L, -1));
lua_pop(L, 1);
- lua_pushliteral(L, "wParamDown");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "wParamDown");
tbb->wParamDown = luaM_towparam(L, -1);
lua_pop(L, 1);
- lua_pushliteral(L, "lParamDown");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "lParamDown");
tbb->lParamDown = luaM_tolparam(L, -1);
lua_pop(L, 1);
diff --git a/plugins/MirLua/src/mlua_metatable.h b/plugins/MirLua/src/mlua_metatable.h index 048c4f425c..eb8ee722d2 100644 --- a/plugins/MirLua/src/mlua_metatable.h +++ b/plugins/MirLua/src/mlua_metatable.h @@ -121,6 +121,8 @@ public: lua_setglobal(L, MT::name);
luaL_newmetatable(L, MT::name);
+ lua_pushcfunction(L, lua__new);
+ lua_setfield(L, -2, "__call");
lua_pushcfunction(L, lua__index);
lua_setfield(L, -2, "__index");
lua_pushcfunction(L, lua__gc);
diff --git a/plugins/MirLua/src/mlua_script.cpp b/plugins/MirLua/src/mlua_script.cpp index 8eae3b4239..bfe827418b 100644 --- a/plugins/MirLua/src/mlua_script.cpp +++ b/plugins/MirLua/src/mlua_script.cpp @@ -50,15 +50,13 @@ bool CMLuaScript::Load() if (!lua_istable(L, -1))
return true;
- lua_pushliteral(L, "Load");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Load");
if (lua_isfunction(L, -1))
luaM_pcall(L);
else
lua_pop(L, 1);
- lua_pushliteral(L, "Unload");
- lua_gettable(L, -2);
+ lua_getfield(L, -1, "Unload");
if (lua_isfunction(L, -1))
{
lua_pushvalue(L, -1);
diff --git a/plugins/MirLua/src/mlua_utils.cpp b/plugins/MirLua/src/mlua_utils.cpp index db8544dbd7..9b5d9ca9ee 100644 --- a/plugins/MirLua/src/mlua_utils.cpp +++ b/plugins/MirLua/src/mlua_utils.cpp @@ -50,7 +50,7 @@ int luaM_print(lua_State *L) switch (lua_type(L, i))
{
case LUA_TNIL:
- data.AppendFormat("%s ", "nil");
+ data.Append("nil ");
break;
case LUA_TBOOLEAN:
data.AppendFormat("%s ", lua_toboolean(L, i) ? "true" : "false");
@@ -60,10 +60,10 @@ int luaM_print(lua_State *L) data.AppendFormat("%s ", lua_tostring(L, i));
break;
case LUA_TTABLE:
- data.AppendFormat("%s ", "table");
+ data.AppendFormat("table(0x%p) ", lua_topointer(L, i));
break;
default:
- data.AppendFormat("0x%p ", lua_topointer(L, i));
+ data.AppendFormat("%s(0x%p) ", luaL_typename(L, i), lua_topointer(L, i));
break;
}
}
@@ -149,12 +149,8 @@ int luaM_totable(lua_State *L) {
const char *tname = luaL_checkstring(L, 2);
- lua_getglobal(L, tname);
- if (lua_type(L, -1) == LUA_TNIL)
- {
- luaL_getmetatable(L, tname);
- lua_getfield(L, -1, "__init");
- }
+ luaL_getmetatable(L, tname);
+ lua_getfield(L, -1, "__call");
lua_pushvalue(L, 1);
luaM_pcall(L, 1, 1);
diff --git a/plugins/MirLua/src/stdafx.h b/plugins/MirLua/src/stdafx.h index 73573652ef..9eb436bfa7 100644 --- a/plugins/MirLua/src/stdafx.h +++ b/plugins/MirLua/src/stdafx.h @@ -62,9 +62,9 @@ extern HANDLE g_hScriptsFolder; extern HANDLE hNetlib;
#ifdef _UNICODE
-#define MIRLUA_CPATHT MIRANDA_PATHW L""
+#define MIRLUA_CPATHT L""
#else
-#define MIRLUA_CPATHT MIRANDA_PATH ""
+#define MIRLUA_CPATHT ""
#endif
#ifdef _UNICODE
|