From dc7e4527e88ed0c59e17c0ff04c01e1c92136e42 Mon Sep 17 00:00:00 2001 From: amelia squires Date: Mon, 14 Apr 2025 14:03:08 -0500 Subject: config change, local support, overall fixes --- src/thread.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/thread.c') diff --git a/src/thread.c b/src/thread.c index db8e54e..a6be01b 100644 --- a/src/thread.c +++ b/src/thread.c @@ -125,8 +125,10 @@ void* handle_thread(void* _args){ lua_setmetatable(L, res_idx); luaL_loadbuffer(L, args->function->c, args->function->len, "thread"); + int x = lua_gettop(L); str_free(args->function); + lua_assign_upvalues(L, x); lua_pushvalue(L, res_idx); lua_call(L, 1, 0); @@ -182,9 +184,10 @@ int l_async(lua_State* oL){ lua_gc(L, LUA_GCSTOP); luaL_openlibs(L); - lua_getglobal(oL, "_G"); - luaI_deepcopy(oL, L, SKIP_GC); - lua_set_global_table(L); + //lua_getglobal(oL, "_G"); + //luaI_deepcopy(oL, L, SKIP_GC); + //lua_set_global_table(L); + luaI_copyvars(oL, L); struct thread_info* args = calloc(1, sizeof * args); args->L = L; -- cgit v1.2.3