aboutsummaryrefslogtreecommitdiff
path: root/src/3rdparty/luax/luax.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/luax/luax.h')
-rw-r--r--src/3rdparty/luax/luax.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/3rdparty/luax/luax.h b/src/3rdparty/luax/luax.h
index 49036b9..b5ef0f4 100644
--- a/src/3rdparty/luax/luax.h
+++ b/src/3rdparty/luax/luax.h
@@ -50,6 +50,8 @@
*/
#define luax_gettop lua_gettop
+#define luax_gettable lua_gettable
+
/**
* Check userdata type.
*/
@@ -57,6 +59,20 @@
#define luax_checknumber luaL_checknumber
#define luax_checkinteger luaL_checkinteger
#define luax_checkstring luaL_checkstring
+#define luax_checkbool luaL_checkinteger
+//bool luax_checkbool(lua_State *L, int numArg)
+//{
+// bool b = false;
+// if (lua_type(L, numArg) == LUA_TBOOLEAN)
+// {
+// b = lua_toboolean(L, numArg);
+// }
+// else
+// {
+// luaL_typerror(L, numArg, lua_typename(L, LUA_TBOOLEAN));
+// }
+// return b;
+//}
/**
* Oprating tables.
@@ -103,6 +119,30 @@
* If nosuch field push a nil at the top of stack.
*/
#define luax_getfield(L, I, N) lua_getfield(L, I, N)
+inline float luax_getfield_number(lua_State* L, int I, const char* N)
+{
+ luax_getfield(L, I, N);
+ float n = luax_checknumber(L, -1);
+ return n;
+}
+inline int luax_getfield_integer(lua_State* L, int I, const char* N)
+{
+ luax_getfield(L, I, N);
+ int bin = luax_checkinteger(L, -1);
+ return bin;
+}
+inline const char* luax_getfield_string(lua_State* L, int I, const char* N)
+{
+ luax_getfield(L, I, N);
+ const char* str = luax_checkstring(L, -1);
+ return str;
+}
+inline char luax_getfield_bool(lua_State* L, int I, const char* N)
+{
+ luax_getfield(L, I, N);
+ char bin = lua_toboolean(L, -1);
+ return bin;
+}
/**
* Set raw