From 43f85a15884a344238e25c118768d36976ae783a Mon Sep 17 00:00:00 2001 From: ame Date: Tue, 7 May 2024 14:09:48 -0500 Subject: more work on threads --- src/lua.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/lua.c') 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)); + } +} + -- cgit v1.2.3