diff options
| author | ame <[email protected]> | 2024-02-05 16:03:56 -0600 |
|---|---|---|
| committer | ame <[email protected]> | 2024-02-05 16:03:56 -0600 |
| commit | 76e750677841a659556fd20741aec33b922bcfdb (patch) | |
| tree | e4bb24263fade94cbeeaaa81a6ef5e0d352cb461 /src/lua.h | |
| parent | 80f4057a7634fd51832f60ca5a91887d9cb853f2 (diff) | |
cleaning and fixes
Diffstat (limited to 'src/lua.h')
| -rw-r--r-- | src/lua.h | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -4,6 +4,23 @@ void i_dcopy(lua_State* src, lua_State* dest, void*);
+//generic macro that takes other macros (see below)
+#define _tset_b(L, Tidx, K, V, F)\
+ lua_pushvalue(L, Tidx);\
+ lua_pushstring(L, K);\
+ F(L, V);\
+ lua_settable(L, Tidx);
+
+//some macros to make batch adding easier (may switch to arrays for this later)
+#define luaI_tseti(L, Tidx, K, V)\
+ _tset_b(L, Tidx, K, V, lua_pushinteger)
+#define luaI_tsets(L, Tidx, K, V)\
+ _tset_b(L, Tidx, K, V, lua_pushstring)
+#define luaI_tsetv(L, Tidx, K, V)\
+ _tset_b(L, Tidx, K, V, lua_pushvalue)
+#define luaI_tsetcf(L, Tidx, K, V)\
+ _tset_b(L, Tidx, K, V, lua_pushcfunction)
+
#if LUA_VERSION_NUM == 504
#define lreg(N, FN)\
lua_pushstring(L, N);\
|
