From b56d4e570a60a8e84df8288c3122eb5bb5c20af6 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 14 Mar 2019 15:30:54 -0300 Subject: Changes in the warning system - The warning functions get an extra parameter that tells whether message is to be continued (instead of using end-of-lines as a signal). - The user data for the warning function is a regular value, instead of a writable slot inside the Lua state. --- lgc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lgc.c') diff --git a/lgc.c b/lgc.c index bf0460d5..c834319b 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 (tm != NULL && ttisfunction(tm)) { /* is there a finalizer? */ + if (ttisfunction(tm)) { /* is the finalizer a function? */ int status; lu_byte oldah = L->allowhook; int running = g->gcrunning; @@ -850,9 +850,9 @@ static void GCTM (lua_State *L) { const char *msg = (ttisstring(s2v(L->top - 1))) ? svalue(s2v(L->top - 1)) : "error object is not a string"; - luaE_warning(L, "error in __gc metamethod ("); - luaE_warning(L, msg); - luaE_warning(L, ")\n"); + luaE_warning(L, "error in __gc metamethod (", 1); + luaE_warning(L, msg, 1); + luaE_warning(L, ")", 0); } } } -- cgit v1.2.3-55-g6feb