aboutsummaryrefslogtreecommitdiff
path: root/ldebug.c
diff options
context:
space:
mode:
Diffstat (limited to 'ldebug.c')
-rw-r--r--ldebug.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/ldebug.c b/ldebug.c
index 8cb00e51..819550d7 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -629,12 +629,10 @@ static const char *funcnamefromcode (lua_State *L, CallInfo *ci,
629 case OP_LEN: tm = TM_LEN; break; 629 case OP_LEN: tm = TM_LEN; break;
630 case OP_CONCAT: tm = TM_CONCAT; break; 630 case OP_CONCAT: tm = TM_CONCAT; break;
631 case OP_EQ: tm = TM_EQ; break; 631 case OP_EQ: tm = TM_EQ; break;
632 case OP_LT: case OP_LE: case OP_LTI: case OP_LEI: 632 /* no cases for OP_EQI and OP_EQK, as they don't call metamethods */
633 *name = "order"; /* '<=' can call '__lt', etc. */ 633 case OP_LT: case OP_LTI: case OP_GTI: tm = TM_LT; break;
634 return "metamethod"; 634 case OP_LE: case OP_LEI: case OP_GEI: tm = TM_LE; break;
635 case OP_CLOSE: case OP_RETURN: 635 case OP_CLOSE: case OP_RETURN: tm = TM_CLOSE; break;
636 *name = "close";
637 return "metamethod";
638 default: 636 default:
639 return NULL; /* cannot find a reasonable name */ 637 return NULL; /* cannot find a reasonable name */
640 } 638 }
@@ -697,6 +695,19 @@ l_noret luaG_typeerror (lua_State *L, const TValue *o, const char *op) {
697} 695}
698 696
699 697
698l_noret luaG_callerror (lua_State *L, const TValue *o) {
699 CallInfo *ci = L->ci;
700 const char *name = NULL; /* to avoid warnings */
701 const char *what = (isLua(ci)) ? funcnamefromcode(L, ci, &name) : NULL;
702 if (what != NULL) {
703 const char *t = luaT_objtypename(L, o);
704 luaG_runerror(L, "%s '%s' is not callable (a %s value)", what, name, t);
705 }
706 else
707 luaG_typeerror(L, o, "call");
708}
709
710
700l_noret luaG_forerror (lua_State *L, const TValue *o, const char *what) { 711l_noret luaG_forerror (lua_State *L, const TValue *o, const char *what) {
701 luaG_runerror(L, "bad 'for' %s (number expected, got %s)", 712 luaG_runerror(L, "bad 'for' %s (number expected, got %s)",
702 what, luaT_objtypename(L, o)); 713 what, luaT_objtypename(L, o));