diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2016-01-02 20:06:32 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2016-01-02 20:06:32 +0000 |
commit | 7540dae59505b5c5d38507a05116c493cce628cb (patch) | |
tree | 8e27782c0a968ebd2c641d1eb241f2de6f8fca84 /plugins/MirLua/src/m_protocols.cpp | |
parent | cc5d3042679c7afbbf510e4f3e8e9937b2ce0233 (diff) |
MirLua: metatable fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@15997 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/src/m_protocols.cpp')
-rw-r--r-- | plugins/MirLua/src/m_protocols.cpp | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/plugins/MirLua/src/m_protocols.cpp b/plugins/MirLua/src/m_protocols.cpp index 0a687fe14a..4492c23232 100644 --- a/plugins/MirLua/src/m_protocols.cpp +++ b/plugins/MirLua/src/m_protocols.cpp @@ -158,23 +158,6 @@ static luaL_Reg protocolsApi[] = #define MT_CCSDATA "CCSDATA"
-static int ccs__init(lua_State *L)
-{
- CCSDATA *udata = (CCSDATA*)lua_touserdata(L, 1);
- if (udata == NULL)
- {
- lua_pushnil(L);
- return 1;
- }
-
- CCSDATA **ccs = (CCSDATA**)lua_newuserdata(L, sizeof(CCSDATA*));
- *ccs = udata;
-
- luaL_setmetatable(L, MT_CCSDATA);
-
- return 1;
-}
-
static int ccs__index(lua_State *L)
{
CCSDATA *ccs = *(CCSDATA**)luaL_checkudata(L, 1, MT_CCSDATA);
@@ -193,13 +176,6 @@ static int ccs__index(lua_State *L) return 1;
}
-static luaL_Reg ccsMeta[] =
-{
- { "__init", ccs__init },
- { "__index", ccs__index },
- { NULL, NULL }
-};
-
/***********************************************/
LUAMOD_API int luaopen_m_protocols(lua_State *L)
@@ -230,8 +206,8 @@ LUAMOD_API int luaopen_m_protocols(lua_State *L) .Field(&ACKDATA::lParam, "lParam", LUA_TLIGHTUSERDATA);
lua_pop(L, 1);
- luaL_newmetatable(L, MT_CCSDATA);
- luaL_setfuncs(L, ccsMeta, 0);
+ MT<CCSDATA>(L, MT_CCSDATA)
+ .Method(ccs__index, "__index");
lua_pop(L, 1);
return 1;
|