From 93ce22ab552316d5771f2240d29548ea9a04c2e2 Mon Sep 17 00:00:00 2001 From: chenyuekai <757508641@qq.com> Date: Wed, 16 Sep 2020 16:28:55 +0800 Subject: [PATCH] Update tolua_push.c coding error ... --- src/lib/tolua_push.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lib/tolua_push.c b/src/lib/tolua_push.c index 6394147..100715b 100644 --- a/src/lib/tolua_push.c +++ b/src/lib/tolua_push.c @@ -101,12 +101,13 @@ TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type) lua_remove(L, -2); return; } + + /* type represents a more specilized type */ + /*luaL_getmetatable(L,type); // stack: mt ubox[u] super super[mt] flag mt */ + lua_pushvalue(L, -5); /* stack: mt ubox[u] super super[mt] flag mt */ + lua_setmetatable(L,-5); /* stack: mt ubox[u] super super[mt] flag */ + lua_pop(L,3); /* stack: mt ubox[u] */ } - /* type represents a more specilized type */ - /*luaL_getmetatable(L,type); // stack: mt ubox[u] super super[mt] flag mt */ - lua_pushvalue(L, -5); /* stack: mt ubox[u] super super[mt] flag mt */ - lua_setmetatable(L,-5); /* stack: mt ubox[u] super super[mt] flag */ - lua_pop(L,3); /* stack: mt ubox[u] */ } lua_remove(L, -2); /* stack: ubox[u]*/ }