From 9a37dc0ce64c51fd57f5e658a5af8f3671a26b0a Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 25 Jul 2019 13:55:29 -0300 Subject: Small corrections when setting 'L->top' - OP_NEWTABLE can use 'ra + 1' to set top (instead of ci->top); - OP_CLOSE doesn't need to set top ('Protect' already does that); - OP_TFORCALL must use 'ProtectNT', to preserve the top already set. (That was a small bug, because iterators could be called with extra parameters besides the state and the control variable.) - Comments and an extra test for the bug in previous item. --- testes/nextvar.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'testes') diff --git a/testes/nextvar.lua b/testes/nextvar.lua index a7fe625e..9d919631 100644 --- a/testes/nextvar.lua +++ b/testes/nextvar.lua @@ -671,7 +671,8 @@ collectgarbage() local function f (n, p) local t = {}; for i=1,p do t[i] = i*10 end - return function (_,n) + return function (_, n, ...) + assert(select("#", ...) == 0) -- no extra arguments if n > 0 then n = n-1 return n, table.unpack(t) -- cgit v1.2.3-55-g6feb