I am sorry if this is a very basic question, but I am a beginner and am having issues with differentiating between local and global variables. For example:
variable=0
local variable=0
function func()
local variable=0
variable=0
if variable==0 then
local variable=1
end
end
(1) How many separate variables do I have? (2) Which variable is being reassigned in the if statement block? Or is it a new variable separate from all the others? (3) Which variable is the if statement testing for? (4) How do I set a new value to the 1st local variable in the function inside my if statement block? Would that not be just instantiating a new variable limited to the if statement block?
Any help would be greatly appreciated!