diff options
Diffstat (limited to 'src/thread.c')
| -rw-r--r-- | src/thread.c | 9 |
1 files changed, 6 insertions, 3 deletions
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;
|
