Fix lua 5.5 incompatibilities#678
Open
spotaws wants to merge 1 commit into
Open
Conversation
…ol variables within the for loop Signed-off-by: Tom spot Callaway <spotaws@amazon.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With Lua 5.5, for loop control variables are now read-only by default. These changes fix that issue across all the scripts in this repository. Note that these fixes are backwards compatible with Lua 5.4.
The change in tools/script_manager.lua is a little unique. It has this at the end of the for loop:
i = i + 1... where
iis the for loop control variable. Even in Lua 5.4, this ... didn't do anything. Hypothetically, if theivariable was used at a later point in the for loop, that line might have merit, but it's the last line of the for loop. Lua (as far as I can find) has always kept the counter value separate from any manipulation within the loop, so this line is just a no-op, and I'm not entirely sure why it was there. Commenting it out should be safe and will resolve the Lua 5.5 error.I searched through all the scripts to see if there were any other Lua 5.5 incompatibilities besides modifying the for loop control var inside the loop, and I could not find any.