diff options
| author | amelia squires <[email protected]> | 2024-09-29 02:49:05 -0500 |
|---|---|---|
| committer | amelia squires <[email protected]> | 2024-09-29 02:49:05 -0500 |
| commit | e29d3ea86551380ace8e2c86c9f1f63e901941e1 (patch) | |
| tree | 526d2f71581e2584c9de2b958fd89b6ce0fb0ac1 /src/thread.c | |
| parent | 1feb3c40514a7c1726f29502ce37966c308bea79 (diff) | |
docs n stuff
Diffstat (limited to 'src/thread.c')
| -rw-r--r-- | src/thread.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/thread.c b/src/thread.c index 033da33..db8e54e 100644 --- a/src/thread.c +++ b/src/thread.c @@ -269,6 +269,7 @@ int _buffer_mod(lua_State* L){ int l_buffer_index(lua_State* L){
uint64_t len, hash;
+ struct thread_buffer *buffer = lua_touserdata(L, 1);
const char* str = luaL_tolstring(L, 2, &len);
hash = fnv_1((uint8_t*)str, len, v_1);
@@ -284,7 +285,15 @@ int l_buffer_index(lua_State* L){ lua_pushcfunction(L, _buffer_mod);
break;
default:
- lua_pushnil(L);
+ lua_pushstring(buffer->L, str);
+ lua_gettable(buffer->L, 1);
+ if(lua_isnil(buffer->L, -1)){
+ lua_pushnil(L);
+ return 1;
+ }
+
+ luaI_deepcopy(buffer->L, L, SKIP_GC);
+ lua_pop(buffer->L, 1);
break;
}
return 1;
@@ -349,7 +358,6 @@ return __proxy_call(__this_obj,'%s',table.unpack({_a,_b,_c}));end", key); }
int l_buffer_gc(lua_State* L){
- printf("gc\n");
struct thread_buffer *buffer = lua_touserdata(L, 1);
pthread_mutex_lock(&*buffer->lock);
pthread_mutex_destroy(&*buffer->lock);
@@ -387,9 +395,8 @@ int l_buffer(lua_State* L){ void _lua_getfenv(lua_State* L){
}
-int l_testcopy(lua_State* L){
-
+int l_testcopy(lua_State* L){
lua_State* temp = luaL_newstate();
luaI_deepcopy(L, temp, SKIP_GC);
lua_close(temp);
|
