Skip to content

Instantly share code, notes, and snippets.

@videlais
Created April 13, 2018 03:16
Embed
What would you like to do?
scopeproblem.lua
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