diff options
-rw-r--r-- | plugins/MirLua/src/m_msg_buttonsbar.cpp | 8 | ||||
-rw-r--r-- | plugins/MirLua/src/mlua_metatable.h | 13 |
2 files changed, 5 insertions, 16 deletions
diff --git a/plugins/MirLua/src/m_msg_buttonsbar.cpp b/plugins/MirLua/src/m_msg_buttonsbar.cpp index 4082fa0ba0..662441a4ad 100644 --- a/plugins/MirLua/src/m_msg_buttonsbar.cpp +++ b/plugins/MirLua/src/m_msg_buttonsbar.cpp @@ -262,10 +262,10 @@ LUAMOD_API int luaopen_m_msg_buttonsbar(lua_State *L) luaL_newlib(L, msgbuttinsbarApi);
MT<CustomButtonClickData>(L, "CustomButtonClickData")
- .Field(&CustomButtonClickData::pszModule, "Module")
- .Field(&CustomButtonClickData::dwButtonId, "ButtonID")
- .Field(&CustomButtonClickData::hContact, "hContact")
- .Field(&CustomButtonClickData::flags, "Flags");
+ .Field(&CustomButtonClickData::pszModule, "Module", LUA_TSTRINGA)
+ .Field(&CustomButtonClickData::dwButtonId, "ButtonID", LUA_TINTEGER)
+ .Field(&CustomButtonClickData::hContact, "hContact", LUA_TINTEGER)
+ .Field(&CustomButtonClickData::flags, "Flags", LUA_TINTEGER);
lua_pop(L, 1);
/*luaL_newmetatable(L, MT_CUSTOMBUTTONCLICKDATA);
diff --git a/plugins/MirLua/src/mlua_metatable.h b/plugins/MirLua/src/mlua_metatable.h index b0483a2f10..dd8f50032d 100644 --- a/plugins/MirLua/src/mlua_metatable.h +++ b/plugins/MirLua/src/mlua_metatable.h @@ -25,16 +25,6 @@ private: static const char *name;
static std::map<std::string, MTField*> fields;
- template<typename R> static int GetType(R T::*) { return NULL; }
-
- template<> static int GetType(__int32 T::*) { return LUA_TINTEGER; }
- template<> static int GetType(unsigned __int32 T::*) { return LUA_TINTEGER; }
- template<> static int GetType(__int64 T::*) { return LUA_TINTEGER; }
- template<> static int GetType(unsigned __int64 T::*) { return LUA_TINTEGER; }
-
- template<> static int GetType(char* T::*) { return LUA_TSTRINGA; }
- template<> static int GetType(wchar_t* T::*) { return LUA_TSTRINGW; }
-
template<typename R>
static R GetValue(const T *obj, size_t offset, size_t size)
{
@@ -136,10 +126,9 @@ public: }
template<typename R>
- MT& Field(R T::*M, const char *name, int type = LUA_TNONE, size_t size = sizeof(R))
+ MT& Field(R T::*M, const char *name, int type, size_t size = sizeof(R))
{
size_t offset = reinterpret_cast<size_t>(&(((T*)0)->*M));
- if (type == LUA_TNONE) type = GetType(M);
if (type != LUA_TNONE)
fields[name] = new MTField(offset, size, type);
return *this;
|