Control variables in for loops are read only

This commit is contained in:
Roberto Ierusalimschy
2022-12-21 12:04:59 -03:00
parent 540d805226
commit b2f7b3b79f
5 changed files with 40 additions and 37 deletions

View File

@@ -236,7 +236,7 @@ package.path = oldpath
local fname = "file_does_not_exist2"
local m, err = pcall(require, fname)
for t in string.gmatch(package.path..";"..package.cpath, "[^;]+") do
t = string.gsub(t, "?", fname)
local t = string.gsub(t, "?", fname)
assert(string.find(err, t, 1, true))
end