From af975d63f67e6cc2d17f1804acb66328905f8701 Mon Sep 17 00:00:00 2001 From: amelia squires Date: Mon, 21 Apr 2025 20:43:51 -0500 Subject: better version support, fixes, and memory saftey --- src/thread.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/thread.c') diff --git a/src/thread.c b/src/thread.c index f205165..a5eb892 100644 --- a/src/thread.c +++ b/src/thread.c @@ -327,6 +327,11 @@ int meta_proxy(lua_State* L){ //printf("%i\n",count); lua_call(buffer->L, count + 1, 1); luaI_deepcopy(buffer->L, L, 0); + + lua_pushnil(buffer->L); + lua_setmetatable(buffer->L, -2); + + lua_settop(buffer->L, 1); //printf("%p\n", lua_topointer(buffer->L, -1)); return 1; } @@ -349,8 +354,8 @@ void meta_proxy_gen(lua_State* L, struct thread_buffer *buffer, int meta_idx, in char* fn = calloc(128, sizeof * fn); const char* key = lua_tostring(L, k); - sprintf(fn, "return function(_a,_b,_c)\ -return __proxy_call(__this_obj,'%s',__unpack({_a,_b,_c}));end", key); + sprintf(fn, "return function(...)\ +return __proxy_call(__this_obj,'%s',...);end", key); luaL_dostring(L, fn); free(fn); -- cgit v1.2.3