aboutsummaryrefslogtreecommitdiff
path: root/src/lua.c
diff options
context:
space:
mode:
authorame <[email protected]>2024-05-07 14:09:48 -0500
committerame <[email protected]>2024-05-07 14:09:48 -0500
commit43f85a15884a344238e25c118768d36976ae783a (patch)
tree68a9e2f5e2f496fc630d036fd27f2aae9fb2ad23 /src/lua.c
parent618263f6f85d08bfd85d4f0376663aa1e2f58eac (diff)
more work on threads
Diffstat (limited to 'src/lua.c')
-rw-r--r--src/lua.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lua.c b/src/lua.c
index 80f0a3d..868d253 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -158,3 +158,16 @@ void i_dcopy(lua_State* src, lua_State* dest, void* _seen){
//lua_settop(src, old_top);
_seen = seen;
}
+
+/**
+ * @brief extracts a table to be global
+ *
+ * @param {lua_State*} source
+*/
+void lua_set_global_table(lua_State* L){
+ lua_pushnil(L);
+ for(;lua_next(L, -2) != 0;){
+ lua_setglobal(L, lua_tostring(L, -2));
+ }
+}
+