From ca13be9af784b7288d3a07d9b5bccb329086e885 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 16 Aug 2019 09:51:54 -0300 Subject: Supressed errors in '__close' generate warnings --- lstate.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lstate.c') diff --git a/lstate.c b/lstate.c index d4bc53eb..86cd5fb8 100644 --- a/lstate.c +++ b/lstate.c @@ -443,3 +443,19 @@ void luaE_warning (lua_State *L, const char *msg, int tocont) { } +/* +** Generate a warning from an error message +*/ +void luaE_warnerror (lua_State *L, const char *where) { + TValue *errobj = s2v(L->top - 1); /* error object */ + const char *msg = (ttisstring(errobj)) + ? svalue(errobj) + : "error object is not a string"; + /* produce warning "error in %s (%s)" (where, msg) */ + luaE_warning(L, "error in ", 1); + luaE_warning(L, where, 1); + luaE_warning(L, " (", 1); + luaE_warning(L, msg, 1); + luaE_warning(L, ")", 0); +} + -- cgit v1.2.3-55-g6feb