From d0bd25d2e7fb393a6d0a73645a099f9c3b9cc0a8 Mon Sep 17 00:00:00 2001 From: Roberto I Date: Mon, 13 Apr 2026 14:06:23 -0300 Subject: [PATCH] Better error messages for vararg-table fields --- ldebug.c | 2 +- testes/errors.lua | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ldebug.c b/ldebug.c index 8df5f5f2..2665ec7b 100644 --- a/ldebug.c +++ b/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); diff --git a/testes/errors.lua b/testes/errors.lua index c9d85099..c82d5b3b 100644 --- a/testes/errors.lua +++ b/testes/errors.lua @@ -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'")