From d342328e5b24c9b3c6c5b33bfcf9f8534210b8e6 Mon Sep 17 00:00:00 2001 From: Roberto I Date: Thu, 30 Oct 2025 11:07:01 -0300 Subject: Vertical bar removed from syntax of vararg table The syntax 'function foo (a, b, ...arg)' is already used by JavaScript for this same semantics, so it seems natural to use the same notation in Lua. --- testes/memerr.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'testes/memerr.lua') diff --git a/testes/memerr.lua b/testes/memerr.lua index 69d2ef85..2cc8f481 100644 --- a/testes/memerr.lua +++ b/testes/memerr.lua @@ -126,13 +126,13 @@ testamem("coroutine creation", function() end) do -- vararg tables - local function pack (... | t) return t end + local function pack (...t) return t end local b = testamem("vararg table", function () return pack(10, 20, 30, 40, "hello") end) assert(b.aloc == 3) -- new table uses three memory blocks -- table optimized away - local function sel (n, ...|arg) return arg[n] + arg.n end + local function sel (n, ...arg) return arg[n] + arg.n end local b = testamem("optimized vararg table", function () return sel(2.0, 20, 30) end) assert(b.res == 32 and b.aloc == 0) -- no memory needed for this case -- cgit v1.2.3-55-g6feb