From 721eaf37603d3e66c274172428fb012950cb78c2 Mon Sep 17 00:00:00 2001 From: ame Date: Mon, 2 Feb 2026 03:40:54 -0600 Subject: buffer return prev on :set --- src/thread.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/thread.c') 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; -- cgit v1.2.3