From 831e814ce9bdb84e86c06c4a52008f6bdaaa00d6 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 16 Nov 2018 00:24:51 +0800 Subject: =?UTF-8?q?*=E5=90=88=E5=B9=B6master=E5=88=B0minimal=E5=88=86?= =?UTF-8?q?=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lua/libraries/luax/luax.h | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'src/lua/libraries') diff --git a/src/lua/libraries/luax/luax.h b/src/lua/libraries/luax/luax.h index fd10737..311bc95 100644 --- a/src/lua/libraries/luax/luax.h +++ b/src/lua/libraries/luax/luax.h @@ -40,13 +40,13 @@ #define luax_pcall lua_pcall #define luax_setglobal lua_setglobal #define luax_setglobali(L, i, name)\ -lua_pushvalue(L, i);\ -lua_setglobal(L, name); + lua_pushvalue(L, i);\ + lua_setglobal(L, name); #define luax_pop lua_pop #define luax_newtable lua_newtable #define luax_getglobal lua_getglobal -#define luax_clear(L) lua_settop(L, 0) +#define luax_clearstack(L) lua_settop(L, 0) /** * */ @@ -89,6 +89,14 @@ inline bool luax_checkbool(lua_State *L, int numArg) */ /* get value and leaves it on top of stack */ #define luax_rawgetnumber(L, i, k) (lua_rawgeti(L,i, k), lua_tonumber(L, -1)) +inline float luax_rawgetnumberthenpop(lua_State* L, int i, int k) +{ + float n = luax_rawgetnumber(L, i, k); + luax_pop(L, 1); + return n; +} + +#define luax_rawgeti lua_rawgeti /** * @@ -111,6 +119,7 @@ inline bool luax_checkbool(lua_State *L, int numArg) #define luax_pushboolean lua_pushboolean #define luax_pushlightuserdata lua_pushlightuserdata #define luax_pushnil lua_pushnil +#define luax_pushvalue lua_pushvalue //inline void luax_pushuserdata(lua_State* L, void* p) //{ @@ -168,6 +177,10 @@ inline char luax_getfieldbool(lua_State* L, int I, const char* N) char bin = lua_toboolean(L, -1); return bin; } +/** +* +*/ +#define luax_call lua_call /** * Set raw @@ -270,6 +283,7 @@ inline int luax_istype(lua_State* L, int idx, const char* tname) #define luax_istable(L, i) luax_is(table, L, i) #define luax_isnil(L, i) luax_is(nil, L, i) #define luax_isboolean(L, i) luax_is(boolean, L, i) +#define luax_isfunction(L, i) luax_is(function, L, i) #define luax_isuserdata lua_isuserdata #define luax_islightuserdata lua_islightuserdata inline int luax_isinteger(lua_State* L, int i) @@ -417,7 +431,11 @@ inline void luax_setfieldnumbers(lua_State* L, const luax_Num* strs) } } -typedef luaL_Reg luax_Ref; +typedef luaL_Reg luax_Reg; + +#define luax_ref luaL_ref + +#define luax_unref luaL_unref #endif // #if LUA_VERSION_NUM == 501 -- cgit v1.1-26-g67d0