From 7002a39f06ab323970bee8ace4a85fc37c14d882 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Mon, 9 Nov 2015 07:56:54 +0000 Subject: MirLua: attempt to fix build on vs2010 git-svn-id: http://svn.miranda-ng.org/main/trunk@15699 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MirLua/src/mlua_metatable.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'plugins/MirLua/src') diff --git a/plugins/MirLua/src/mlua_metatable.h b/plugins/MirLua/src/mlua_metatable.h index ffedc22134..64ccf5a77d 100644 --- a/plugins/MirLua/src/mlua_metatable.h +++ b/plugins/MirLua/src/mlua_metatable.h @@ -45,7 +45,7 @@ private: return res; } - static int __new(lua_State *L) + static int lua__new(lua_State *L) { T *obj = NULL; T **udata = NULL; @@ -68,7 +68,7 @@ private: return 1; } - static int __index(lua_State *L) + static int lua__index(lua_State *L) { T *obj = *(T**)luaL_checkudata(L, 1, MT::name); const char *key = lua_tostring(L, 2); @@ -111,7 +111,7 @@ private: return 1; } - static int __gc(lua_State *L) + static int lua__gc(lua_State *L) { T** obj = (T**)luaL_checkudata(L, 1, MT::name); MT::Free(obj); @@ -120,19 +120,21 @@ private: static T* Load(lua_State *L) { return (T*)lua_touserdata(L, 1); } static T* Init(T *val) { return val; } - static void Free(T *obj) { obj = NULL; } + static void Free(T **obj) { *obj = NULL; } public: MT(lua_State *L, const char *tname) { MT::name = tname; - lua_pushcfunction(L, __new); + lua_pushcfunction(L, lua__new); lua_setglobal(L, MT::name); luaL_newmetatable(L, MT::name); - lua_pushcfunction(L, __index); + lua_pushcfunction(L, lua__index); lua_setfield(L, -2, "__index"); + lua_pushcfunction(L, lua__gc); + lua_setfield(L, -2, "__gc"); } template -- cgit v1.2.3