From 4bd10b6fe81c0a56eb9e01e24fba10e655966870 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 29 Dec 2020 13:15:54 -0300 Subject: Better error messages for calling non-callable objects When available, use the calling code to find a suitable name for what was being called; this is particularly useful for errors of non-callable metamethods. This commit also improved the debug information for order metamethods. --- ldo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ldo.c') diff --git a/ldo.c b/ldo.c index d39edab0..5e3828f4 100644 --- a/ldo.c +++ b/ldo.c @@ -372,7 +372,7 @@ void luaD_tryfuncTM (lua_State *L, StkId func) { const TValue *tm = luaT_gettmbyobj(L, s2v(func), TM_CALL); StkId p; if (unlikely(ttisnil(tm))) - luaG_typeerror(L, s2v(func), "call"); /* nothing to call */ + luaG_callerror(L, s2v(func)); /* nothing to call */ for (p = L->top; p > func; p--) /* open space for metamethod */ setobjs2s(L, p, p-1); L->top++; /* stack space pre-allocated by the caller */ -- cgit v1.2.3-55-g6feb