summaryrefslogtreecommitdiff
path: root/xmake/scripts
diff options
context:
space:
mode:
authorruki <[email protected]>2024-04-03 23:55:17 +0800
committerruki <[email protected]>2024-04-03 23:55:17 +0800
commitf716446fa869ef4dc9663d69a3e4364ef2dcbb6b (patch)
tree2e8f5cdba8fd46558d199b42de79b4392a523353 /xmake/scripts
parent953bb535caed3c53c8789e55c2f2a3208f1c4008 (diff)
use xmi.h
Diffstat (limited to 'xmake/scripts')
-rw-r--r--xmake/scripts/module/xmi.h30
1 files changed, 23 insertions, 7 deletions
diff --git a/xmake/scripts/module/xmi.h b/xmake/scripts/module/xmi.h
index 598d23ef3..c9a2d0a6f 100644
--- a/xmake/scripts/module/xmi.h
+++ b/xmake/scripts/module/xmi.h
@@ -27,18 +27,34 @@
#include <stdlib.h>
/* //////////////////////////////////////////////////////////////////////////////////////
+ * macros
+ */
+#define xmi_lua_createtable(lua, narr, nrec) lua->_lua_createtable(lua->_lua, narr, nrec)
+#define xmi_lua_newtable(lua) xmi_lua_createtable(lua, 0, 0)
+
+#ifndef LUA_VERSION
+# define lua_createtable xmi_lua_createtable
+# define lua_newtable xmi_lua_newtable
+
+# define luaL_Reg xmi_luaL_Reg
+# define lua_State struct xmi_lua_State_
+#endif
+
+/* //////////////////////////////////////////////////////////////////////////////////////
* types
*/
-struct lua_State_;
-typedef struct luaL_Reg_ {
+struct xmi_lua_State_;
+typedef struct xmi_luaL_Reg_ {
char const* name;
- int (*func)(struct lua_State_* lua);
-}luaL_Reg;
+ int (*func)(struct xmi_lua_State_* lua);
+}xmi_luaL_Reg;
+
+typedef struct xmi_lua_State_ {
+ void* _lua;
+ void (*_lua_createtable)(lua_State* lua, int narr, int nrec);
+}xmi_lua_State;
-typedef struct lua_State_ {
- void* ctx;
-}lua_State;
#endif