summaryrefslogtreecommitdiff
path: root/plugins/MirLua/src/m_chat.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2016-06-13 18:22:20 +0000
committerAlexander Lantsev <aunsane@gmail.com>2016-06-13 18:22:20 +0000
commit1c6b8b1f06d26f3ac4db17d6eb203538ba358057 (patch)
tree28847ce93f6162b33245d0d714a75cdb4303ff7c /plugins/MirLua/src/m_chat.cpp
parentbfef141fa44aace5d845bfa0d06e4435c97984ba (diff)
MirLua: break backward compatibility
- removed BLOB metatable - m_database's blob now used simple lua table - removed deprecated functions from m_core - added PROTORECVEVENT metatable - added GCDEST metatable - version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@16968 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/src/m_chat.cpp')
-rw-r--r--plugins/MirLua/src/m_chat.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/plugins/MirLua/src/m_chat.cpp b/plugins/MirLua/src/m_chat.cpp
index da45fd93e4..dfe8b3c54d 100644
--- a/plugins/MirLua/src/m_chat.cpp
+++ b/plugins/MirLua/src/m_chat.cpp
@@ -5,14 +5,28 @@ static luaL_Reg chatApi[] =
{ NULL, NULL }
};
+int MT<GCEVENT>::Index(lua_State *L, GCEVENT *gce)
+{
+ const char *key = lua_tostring(L, 2);
+
+ if (mir_strcmp(key, "Destination") == 0)
+ MT<GCDEST>::Set(L, gce->pDest);
+ else
+ lua_pushnil(L);
+
+ return 1;
+}
+
LUAMOD_API int luaopen_m_chat(lua_State *L)
{
luaL_newlib(L, chatApi);
+ MT<GCDEST>(L, "GCDEST")
+ .Field(&GCDEST::pszModule, "Module", LUA_TSTRINGA)
+ .Field(&GCDEST::ptszID, "Id", LUA_TSTRINGW)
+ .Field(&GCDEST::iType, "Type", LUA_TINTEGER);
+
MT<GCEVENT>(L, "GCEVENT")
- .Field([](GCEVENT *gce) { return (void*)gce->pDest->pszModule; }, "Module", LUA_TSTRINGA)
- .Field([](GCEVENT *gce) { return (void*)gce->pDest->ptszID; }, "Id", LUA_TSTRINGW)
- .Field([](GCEVENT *gce) { return (void*)gce->pDest->iType; }, "Type", LUA_TINTEGER)
.Field(&GCEVENT::time, "Timestamp", LUA_TINTEGER)
.Field(&GCEVENT::time, "IsMe", LUA_TINTEGER)
.Field(&GCEVENT::time, "Flags", LUA_TINTEGER)