aboutsummaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-12-29 13:15:54 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-12-29 13:15:54 -0300
commit4bd10b6fe81c0a56eb9e01e24fba10e655966870 (patch)
treeff21703d9f06a0dd4ca4f3317dd0cb7b048c9b8d /ldo.c
parent59e565d9555c07e82808d8c1db8f4f4d159b5e5c (diff)
downloadlua-4bd10b6fe81c0a56eb9e01e24fba10e655966870.tar.gz
lua-4bd10b6fe81c0a56eb9e01e24fba10e655966870.tar.bz2
lua-4bd10b6fe81c0a56eb9e01e24fba10e655966870.zip
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.
Diffstat (limited to '')
-rw-r--r--ldo.c2
1 files changed, 1 insertions, 1 deletions
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) {
372 const TValue *tm = luaT_gettmbyobj(L, s2v(func), TM_CALL); 372 const TValue *tm = luaT_gettmbyobj(L, s2v(func), TM_CALL);
373 StkId p; 373 StkId p;
374 if (unlikely(ttisnil(tm))) 374 if (unlikely(ttisnil(tm)))
375 luaG_typeerror(L, s2v(func), "call"); /* nothing to call */ 375 luaG_callerror(L, s2v(func)); /* nothing to call */
376 for (p = L->top; p > func; p--) /* open space for metamethod */ 376 for (p = L->top; p > func; p--) /* open space for metamethod */
377 setobjs2s(L, p, p-1); 377 setobjs2s(L, p, p-1);
378 L->top++; /* stack space pre-allocated by the caller */ 378 L->top++; /* stack space pre-allocated by the caller */