From be05c444818989463dc307eed283503d391f93eb Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 20 May 2025 17:36:05 -0300 Subject: New way to control preambular declaration Validity of the preambular global declaration in controled together with all declarations, when checking variable names. --- testes/db.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'testes/db.lua') diff --git a/testes/db.lua b/testes/db.lua index ae204c41..0f174f17 100644 --- a/testes/db.lua +++ b/testes/db.lua @@ -349,9 +349,11 @@ end, "crl") function f(a,b) - global collectgarbage, assert, g, string + -- declare some globals to check that they don't interfere with 'getlocal' + global collectgarbage collectgarbage() local _, x = debug.getlocal(1, 1) + global assert, g, string local _, y = debug.getlocal(1, 2) assert(x == a and y == b) assert(debug.setlocal(2, 3, "pera") == "AA".."AA") @@ -387,7 +389,9 @@ function g (...) f(AAAA,B) assert(AAAA == "pera" and B == "manga") do + global * local B = 13 + global assert local x,y = debug.getlocal(1,5) assert(x == 'B' and y == 13) end -- cgit v1.2.3-55-g6feb