Skip to content

Fix for lua 5.5 compatibility, for-loop variables are read only#810

Open
hcartiaux wants to merge 1 commit intoTACC:mainfrom
hcartiaux:roforloop
Open

Fix for lua 5.5 compatibility, for-loop variables are read only#810
hcartiaux wants to merge 1 commit intoTACC:mainfrom
hcartiaux:roforloop

Conversation

@hcartiaux
Copy link

@hcartiaux hcartiaux commented Mar 23, 2026

In lua 5.5, for-loop variables are now read-only, this change produces a bunch of errors similar to this one.

/usr/bin/lua: error loading module 'utils' from file './src/utils.lua':
        ./src/utils.lua:421: attempt to assign to const variable 'v'
stack traceback:
        [C]: in ?
        [C]: in global 'require'
        ./src/colorize.lua:43: in main chunk
        [C]: in global 'require'
        ./src/lmod.in.lua:110: in main chunk
        [C]: in ?

This PR attempts to fix this with minimal changes while trying to maintain code styling.

@LecrisUT
Copy link
Contributor

Should have checked PRs 🙃. I've made #811, but the tests are failing there. Want to cross review each other?

@hcartiaux
Copy link
Author

Should have checked PRs 🙃. I've made #811, but the tests are failing there. Want to cross review each other?

Wow, I also missed #807 actually. You made me realize I've missed quite a few occurrences.

I prefer my approach using a different variable name inside the loop, it's less confusing to me.

Once we agree on the styling, we can import the changes of one PR into the other, fix the tests and close the remaining PR

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