1
0
mirror of https://github.com/skywind3000/z.lua synced 2026-03-12 02:39:48 +00:00

fix: don't reassign for-loop variable

In Lua 5.5 you can no longer reassign for-loop variables, f.e.

```lua
for k, v in pairs(tbl) do k = "foobar" end
```

This PR should fix this problem

Signed-off-by: botantony <antonsm21@gmail.com>
This commit is contained in:
botantony
2025-12-23 22:49:39 +01:00
parent f80e22498c
commit e1eb7a2104

3
z.lua
View File

@@ -235,7 +235,8 @@ end
function dump(o)
if type(o) == 'table' then
local s = '{ '
for k,v in pairs(o) do
for key,v in pairs(o) do
local k = key
if type(k) ~= 'number' then k = '"'..k..'"' end
s = s .. '['..k..'] = ' .. dump(v) .. ','
end