diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-10-30 15:46:56 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-10-30 15:46:56 -0300 |
commit | e073cbc2e538369e0611abfc9948f301aea6aef3 (patch) | |
tree | 6ef30a285092e8bcc15021b1d857a62dbab36fd6 /ldebug.c | |
parent | 2316ec4c24a475e091ec3153a5bd908801a3a109 (diff) | |
download | lua-e073cbc2e538369e0611abfc9948f301aea6aef3.tar.gz lua-e073cbc2e538369e0611abfc9948f301aea6aef3.tar.bz2 lua-e073cbc2e538369e0611abfc9948f301aea6aef3.zip |
Better error messages for invalid operands in numeric 'for'
"Better" and similar to error messages for invalid function arguments.
*old message: 'for' limit must be a number
*new message: bad 'for' limit (number expected, got table)
Diffstat (limited to 'ldebug.c')
-rw-r--r-- | ldebug.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -696,6 +696,12 @@ l_noret luaG_typeerror (lua_State *L, const TValue *o, const char *op) { | |||
696 | } | 696 | } |
697 | 697 | ||
698 | 698 | ||
699 | l_noret luaG_forerror (lua_State *L, const TValue *o, const char *what) { | ||
700 | luaG_runerror(L, "bad 'for' %s (number expected, got %s)", | ||
701 | what, luaT_objtypename(L, o)); | ||
702 | } | ||
703 | |||
704 | |||
699 | l_noret luaG_concaterror (lua_State *L, const TValue *p1, const TValue *p2) { | 705 | l_noret luaG_concaterror (lua_State *L, const TValue *p1, const TValue *p2) { |
700 | if (ttisstring(p1) || cvt2str(p1)) p1 = p2; | 706 | if (ttisstring(p1) || cvt2str(p1)) p1 = p2; |
701 | luaG_typeerror(L, p1, "concatenate"); | 707 | luaG_typeerror(L, p1, "concatenate"); |