Finalizers must be callable
Non-function __gc metamethods are not ignored; if present, the metamethod will be called even if it is not a function.
This commit is contained in:
2
lgc.c
2
lgc.c
@@ -832,7 +832,7 @@ static void GCTM (lua_State *L) {
|
||||
lua_assert(!g->gcemergency);
|
||||
setgcovalue(L, &v, udata2finalize(g));
|
||||
tm = luaT_gettmbyobj(L, &v, TM_GC);
|
||||
if (ttisfunction(tm)) { /* is the finalizer a function? */
|
||||
if (!notm(tm)) { /* is there a finalizer? */
|
||||
int status;
|
||||
lu_byte oldah = L->allowhook;
|
||||
int running = g->gcrunning;
|
||||
|
||||
Reference in New Issue
Block a user