diff options
| author | amelia squires <[email protected]> | 2025-04-21 20:43:51 -0500 |
|---|---|---|
| committer | amelia squires <[email protected]> | 2025-04-21 20:43:51 -0500 |
| commit | af975d63f67e6cc2d17f1804acb66328905f8701 (patch) | |
| tree | ab23744e784044d29cc73cd1da4070011e7e858c /src/thread.c | |
| parent | b2ee662b4621282b137a2a2cf1be13bd60073c5a (diff) | |
better version support, fixes, and memory saftey
Diffstat (limited to 'src/thread.c')
| -rw-r--r-- | src/thread.c | 9 |
1 files changed, 7 insertions, 2 deletions
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);
|
