diff options
| author | ame <[email protected]> | 2025-11-25 03:44:22 -0600 |
|---|---|---|
| committer | ame <[email protected]> | 2025-11-25 03:44:22 -0600 |
| commit | e13cc14a618a1ba817f8d667ea333133028f7e47 (patch) | |
| tree | cc14c4733bef6d2dff287fbfcb9b359f92683524 /src | |
| parent | 691a82c3a7ce7e5f43a15f8751cacc792efa339f (diff) | |
more consistent locals, better test printing
Diffstat (limited to 'src')
| -rw-r--r-- | src/lua.h | 2 | ||||
| -rw-r--r-- | src/thread.c | 13 |
2 files changed, 12 insertions, 3 deletions
@@ -114,6 +114,8 @@ int writer(lua_State*, const void*, size_t, void*); #define lua_gc(A, B) lua_gc(A, B, 0)
#elif LUA_VERSION_NUM == 501
+ #define LUA_OK 0
+
#define luaL_tolstring lua_tolstring
#define lua_dump(A, B, C, D) lua_dump(A, B, C)
diff --git a/src/thread.c b/src/thread.c index fbf5f01..f166c3f 100644 --- a/src/thread.c +++ b/src/thread.c @@ -203,11 +203,15 @@ int _thread_await(lua_State* L){ pthread_mutex_lock(&*info->lock);
if(info->return_count == 0) return 0;
+ lua_getglobal(L, "_locals");
+ int old_locals = lua_gettop(L);
+
+ lua_getglobal(info->L, "_stored_locals");
lua_getglobal(info->L, "_res_locals");
+ luaI_jointable(info->L);
luaI_deepcopy(info->L, L, SKIP_LOCALS | STRIP_GC);
- env_table(L, 0);
+ //env_table(L, 0);
- luaI_jointable(L);
lua_setglobal(L, "_locals");
lua_getglobal(info->L, "_return_table");
@@ -219,7 +223,7 @@ int _thread_await(lua_State* L){ luaI_deepcopy(info->L, L, STRIP_GC);
}
- lua_pushnil(L);
+ lua_pushvalue(L, old_locals);
lua_setglobal(L, "_locals");
pthread_mutex_unlock(&*info->lock);
@@ -300,6 +304,9 @@ int l_async(lua_State* oL){ luaI_copyvars(oL, L);
luaL_openlibs(L);
+ lua_getglobal(L, "_locals");
+ lua_setglobal(L, "_stored_locals");
+
struct thread_info* args = calloc(1, sizeof * args);
args->L = L;
args->lock = malloc(sizeof * args->lock);
|
