diff options
Diffstat (limited to 'plugins/MirLua/src/m_chat.cpp')
-rw-r--r-- | plugins/MirLua/src/m_chat.cpp | 20 |
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)
|