Mercurial > prosody-hg
comparison fallbacks/lxp.lua @ 13925:a4c47203a9eb
various: Do not mutate loop variables as they are treated as const in Lua 5.5
Loop variables are treated as <const> in Lua 5.5 and can't be modified
without declaring another local.
Ref https://github.com/lua/lua/commit/b2f7b3b79f3117885b265575f6c5dbf934757797
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 23 Feb 2024 18:44:13 +0100 |
| parents | bd0ff8ae98a8 |
| children |
comparison
equal
deleted
inserted
replaced
| 13924:7fdf7645b0da | 13925:a4c47203a9eb |
|---|---|
| 84 end | 84 end |
| 85 end | 85 end |
| 86 local newattr, n = {}, 0; | 86 local newattr, n = {}, 0; |
| 87 for k,v in pairs(attr) do | 87 for k,v in pairs(attr) do |
| 88 n = n+1; | 88 n = n+1; |
| 89 k = apply_ns(k); | 89 local k_ = apply_ns(k); |
| 90 newattr[n] = k; | 90 newattr[n] = k_; |
| 91 newattr[k] = v; | 91 newattr[k_] = v; |
| 92 end | 92 end |
| 93 tag = apply_ns(tag, true); | 93 tag = apply_ns(tag, true); |
| 94 ns[0] = tag; | 94 ns[0] = tag; |
| 95 ns.__index = ns; | 95 ns.__index = ns; |
| 96 return tag, newattr; | 96 return tag, newattr; |
