I am a bit confused reagrding local & global variables in lua, in 1st scenario i have the following piece of code
local myvar function dothis() myvar=display.newImage() end
in the above code dothis() is a global function , does myvar declared inside global function is local myvar or is it a global myvar?
now in 2nd scenario i have the following piece of code
--the below function is in file1.lua local myvar function dothis() myvar = display.newImage() require("file2") callfunc2() myvar:removeSelf() end ---the below function is in file2.lua local function move() --does some game logic at 30 fps end function callfunc2() --does some stuff end Runtime:addEventListener("Enterframe", move)
In scenario 2 i am calling a global function present in file2 from file1 but my doubt is when the callfunc2() is called does the execution ever proceed to myvar:removeSelf() or keeps executing the game logic in file2 with out proceeding to myvar:removeSelf()??