Skip to content

fix: make for-loop control variables read-only compatible with Lua 5.5#52

Merged
xjdrew merged 1 commit intoxjdrew:masterfrom
Ne9roni:lua55-compat
Apr 9, 2026
Merged

fix: make for-loop control variables read-only compatible with Lua 5.5#52
xjdrew merged 1 commit intoxjdrew:masterfrom
Ne9roni:lua55-compat

Conversation

@Ne9roni
Copy link
Copy Markdown

@Ne9roni Ne9roni commented Apr 7, 2026

Lua 5.5 makes for-loop control variables read-only (const). Two files were assigning to control variables inside for-loop bodies:

  • levent/dns.lua: 'host = host:lower()' -> use local 'lhost'
  • levent/http/response.lua: 'f = util.canonical_header_key(f)' -> use local 'cf'

These changes are backward compatible with Lua 5.4.

Verified:

  • luac -p passes on both Lua 5.4.7 and Lua 5.5.0
  • Compiles successfully with both Lua 5.4 and 5.5 headers
  • All tests pass on both versions

Lua 5.5 makes for-loop control variables read-only (const).
Two files were assigning to control variables inside for-loop bodies:

- levent/dns.lua: 'host = host:lower()' -> use local 'lhost'
- levent/http/response.lua: 'f = util.canonical_header_key(f)' -> use local 'cf'

These changes are backward compatible with Lua 5.4.

Verified:
- luac -p passes on both Lua 5.4.7 and Lua 5.5.0
- Compiles successfully with both Lua 5.4 and 5.5 headers
- All tests pass on both versions
@xjdrew xjdrew merged commit 02f5c9d into xjdrew:master Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants