From 8fa4f1380b9a203bfdf002c2e9e9e13ebb8384c1 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 14 Mar 2019 15:53:42 -0300 Subject: 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. --- lgc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lgc.c') diff --git a/lgc.c b/lgc.c index c834319b..8cb3e9fa 100644 --- a/lgc.c +++ b/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; -- cgit v1.2.3-55-g6feb