I am stuck. I would love to get some help with how a nested function returns value from inner to outer and then to the actual caller. Pseudo code below to help explain my question. Lets say we want to write a wrapper for network download such as below
How can I take the return from inner function (ie listener) and have the outer function return that value to its caller (ie getFileResult). Thanks for your kind assistance.
local function getMyFile(fileName) local myFunctionResult = false local function networkListener( event ) if ( event.isError ) then myFunctionResult = false -- not needed actually but here for visibility elseif ( event.phase == "ended" ) then myFunctionResult = true -- file downloaded nicely end return myFunctionResult end network.download( fileName, networkListener ) end local getFileResult = getMyFile("thisFile")