mirror of
https://github.com/lua/lua.git
synced 2026-08-03 03:49:04 +00:00
Better error messages for vararg-table fields
This commit is contained in:
2
ldebug.c
2
ldebug.c
@@ -580,7 +580,7 @@ static const char *getobjname (const Proto *p, int lastpc, int reg,
|
||||
kname(p, k, name);
|
||||
return isEnv(p, lastpc, i, 1);
|
||||
}
|
||||
case OP_GETTABLE: {
|
||||
case OP_GETTABLE: case OP_GETVARG: {
|
||||
int k = GETARG_C(i); /* key index */
|
||||
rname(p, lastpc, k, name);
|
||||
return isEnv(p, lastpc, i, 0);
|
||||
|
||||
@@ -159,6 +159,9 @@ assert(not string.find(doit"aaa={13}; local bbbb=1; aaa[bbbb](3)", "'bbbb'"))
|
||||
checkmessage("aaa={13}; local bbbb=1; aaa[bbbb](3)", "number")
|
||||
checkmessage("aaa=(1)..{}", "a table value")
|
||||
|
||||
checkmessage("local function foo (...t) return t.xx + 1 end; foo()",
|
||||
"field 'xx'")
|
||||
|
||||
-- bug in 5.4.6
|
||||
checkmessage("a = {_ENV = {}}; print(a._ENV.x + 1)", "field 'x'")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user