r/lua • u/Kritzel-Kratzel • Feb 13 '26
Lua 5.5.0 - "for-loop variables are read only"
Currently working on integrating Lua 5.5.0 into OneLuaPro. This new "for-loop variables are read-only" feature is really annoying, as it impacts a lot of existing code:
[C:\..._IMPLEMENTED]> for /r %f in (*.lua) do @(C:\misc\OneLuaPro\build64\OneLuaPro-5.4.8.3-x64\bin\luac -p "%f" >nul 2>&1 || echo Lua 5.5 Problem in: %f)
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\ldoc\ldoc\html.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\ldoc\ldoc\markdown.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\ldoc\tests\mod1.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\ldoc\tests\example\style\simple.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\ldoc\tests\factory\factory.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\lua-cjson\tests\bench.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\lua-openssl\test\4.pkey.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\luacheck\spec\samples\compound_operators.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\luacheck\spec\samples\python_code.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\luacheck\spec\samples\utf8_error.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\luacheck\src\luacheck\standards.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\luautf8\parseucd.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\wxlua\wxLua\bindings\any-bind-sync.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\wxlua\wxLua\bindings\genwxbind.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\wxlua\wxLua\bindings\stc-bind-sync.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\wxlua\wxLua\samples\editor.wx.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\wxlua\wxLua\samples\wxluasudoku.wx.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\ZeroBraneStudio\api\lua\corona.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\ZeroBraneStudio\build\messages.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\ZeroBraneStudio\lualibs\luadist.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\ZeroBraneStudio\lualibs\dist\package.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\ZeroBraneStudio\lualibs\luacheck\standards.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\ZeroBraneStudio\lualibs\luainspect\init.lua
Lua 5.5 Problem in: C:\misc_IMPLEMENTED\ZeroBraneStudio\src\util.lua
...Am I actually the first person to discover this?
26
Upvotes
13
u/NakeleKantoo Feb 13 '26
why would you do that? like genuinely asking
i can only imagine manipulating for variables if it's to skip certain things
8
u/drcforbin Feb 13 '26
Lua language version numbers look like semantic versioning, but there aren't. Per The Evolution of Lua, continued, "Different versions are really different."
Lua 5.5 is not the same language as Lua 5.4, and those libraries aren't written in Lua 5.5. I get what you're trying to do with OneLuaPro, but Lua doesn't quite work that way; you can't port your tool to a new Lua version until its dependencies have been ported to that version.
3
u/Old_County5271 Feb 13 '26
FWIW It's not for loop variables but the control variable that is read only
2
u/kcx01 Feb 13 '26
No. It was in the README
https://www.lua.org/manual/5.5/readme.html#changes
3
u/likethevegetable Feb 13 '26
You could share an example slice of code and maybe we can suggest how you should fix it
1
u/weregod Feb 19 '26
Most libraries I'm using have 5.5 branch that fixes incompatible loops.
1
u/[deleted] Feb 14 '26
[removed] — view removed comment