aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorame <[email protected]>2026-02-02 03:40:54 -0600
committerame <[email protected]>2026-02-02 03:40:54 -0600
commit721eaf37603d3e66c274172428fb012950cb78c2 (patch)
tree4416964f5458a1fb6661a05f337ef9c3b6cc60f3 /src
parent2f81ec62dd0690cf03d7386d8f1e828388ba7e58 (diff)
buffer return prev on :set
Diffstat (limited to 'src')
-rw-r--r--src/thread.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/thread.c b/src/thread.c
index 555a62b..1e58aef 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -392,12 +392,14 @@ int _buffer_get(lua_State* L){
return 1;
}
-#warning "how do you handle gc for the new object?"
int _buffer_set(lua_State* L){
struct thread_buffer *buffer = lua_touserdata(L, 1);
pthread_mutex_lock(&*buffer->lock);
+ luaI_deepcopy(buffer->L, L, SKIP_LOCALS | STRIP_GC);
lua_settop(buffer->L, 0);
+ lua_pushvalue(L, -2);
luaI_deepcopy(L, buffer->L, SKIP_LOCALS | STRIP_GC);
+ lua_pop(L, 1);
pthread_mutex_unlock(&*buffer->lock);
return 1;