Skip to content

How do locals not interfere with each other? #34

Closed Answered by francois
TheAtomAnt asked this question in Q&A
Discussion options

You must be logged in to vote

Ooops! I completely forgot about that! Thank you very much for highlighting this issue.

Your expectations are correct, but the generated code isn't. Locals in functions are not actually "local": they're in the global namespace of Mindustry Logic. As you suspected, "but locals are not maintained". In your case, "n" should be pushed on the stack, and restored afterwards.

I will create an issue for tracking purposes, and fix this in the coming days.

Thank you very much for reporting this!

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by TheAtomAnt
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants