diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2016-06-15 08:13:23 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2016-06-15 08:13:23 +0000 |
commit | bb3b1f898e5530e22fa8f48f786fca300cdd36d2 (patch) | |
tree | 6731a89e0bebbb96386151fd4346d837476f2574 /plugins/MirLua | |
parent | 2b16df81fe835d441e4dde275c3894a1fcdc66d3 (diff) |
MirLua: DBEVENTINFO.Blob should be table
git-svn-id: http://svn.miranda-ng.org/main/trunk@16975 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua')
-rw-r--r-- | plugins/MirLua/src/m_database.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/plugins/MirLua/src/m_database.cpp b/plugins/MirLua/src/m_database.cpp index 588e27af82..f37182e210 100644 --- a/plugins/MirLua/src/m_database.cpp +++ b/plugins/MirLua/src/m_database.cpp @@ -651,6 +651,21 @@ void MT<DBEVENTINFO>::Init(lua_State *L, DBEVENTINFO **dbei) db_event_get((MEVENT)hDbEvent, (*dbei));
}
+int MT<DBEVENTINFO>::Index(lua_State *L, DBEVENTINFO *dbei)
+{
+ const char *key = luaL_checkstring(L, 2);
+
+ if (mir_strcmpi(key, "Blob") == 0)
+ {
+ lua_createtable(L, dbei->cbBlob, 0);
+ for (int i = 0; i < dbei->cbBlob; i++)
+ {
+ lua_pushinteger(L, dbei->pBlob[i]);
+ lua_rawseti(L, -2, i + 1);
+ }
+ }
+}
+
void MT<DBEVENTINFO>::Free(lua_State*, DBEVENTINFO **dbei)
{
mir_free((*dbei)->pBlob);
@@ -684,9 +699,7 @@ LUAMOD_API int luaopen_m_database(lua_State *L) .Field(&DBEVENTINFO::szModule, "Module", LUA_TSTRINGA)
.Field(&DBEVENTINFO::timestamp, "Timestamp", LUA_TINTEGER)
.Field(&DBEVENTINFO::eventType, "Type", LUA_TINTEGER)
- .Field(&DBEVENTINFO::flags, "Flags", LUA_TINTEGER)
- .Field(&DBEVENTINFO::cbBlob, "Length", LUA_TINTEGER)
- .Field(&DBEVENTINFO::pBlob, "Blob", LUA_TLIGHTUSERDATA);
+ .Field(&DBEVENTINFO::flags, "Flags", LUA_TINTEGER);
return 1;
}
|