scopeproblem.lua
This file contains 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
testValue = 1 | |
function newFunction() | |
-- This will work | |
print("The value is " .. testValue) | |
local newValue = 2; | |
end | |
newFunction() | |
-- This will NOT work. | |
-- newValue is only defined within the scope of newFunction() | |
print("What is newValue?" .. newValue) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment