diff options
author | sanine <sanine.not@pm.me> | 2022-08-22 21:37:12 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-08-22 21:37:12 -0500 |
commit | 1f75a21851b0a0bd4bc766c458e67721dd37c9fd (patch) | |
tree | 498b9f43176f098c852099707e5eb1717bcd1ec1 /src/util/util.c | |
parent | 1f47b685f35455afcc7441389cdc60018f66d159 (diff) |
add append_table()
Diffstat (limited to 'src/util/util.c')
-rw-r--r-- | src/util/util.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util/util.c b/src/util/util.c new file mode 100644 index 0000000..84edd27 --- /dev/null +++ b/src/util/util.c @@ -0,0 +1,12 @@ +#include <lua.h> + +void append_table(lua_State *L, int tbl_a, int tbl_b) +{ + lua_pushnil(L); + while(lua_next(L, tbl_b) != 0) { + lua_pushvalue(L, -2); // key + lua_pushvalue(L, -2); // value + lua_settable(L, tbl_a); + lua_pop(L, 1); + } +} |