It looks like you're new here. If you want to get involved, click one of these buttons!
function GetHighScores() local url = "<a href="http://www.jalmince-lab.com/BallTrip/high_scores.php"" rel="nofollow">http://www.jalmince-lab.com/BallTrip/high_scores.php"</a>; local headers = { ["Content-Type"] = "application/x-www-form-urlencoded"} local result = "" local function onComplete(event) result = event.data end local loader = UrlLoader.new(url, UrlLoader.POST ) loader:addEventListener(Event.COMPLETE, onComplete) --- Need a "delay" here !! return(result) end |
Comments
You should call drawGUI function inside onComplete function
onComplete is callback function, so when url load done, it's return result, and then you can pass it to other method to execute next ( that why you don't have to return in GetHighScores function)
The weather example processes the xml result INSIDE the onComplete function.
Imagine now that you want to create a function, say "get_weather()", that returns the xml from yahoo, and that you want to call that fonction from another function; for example:
Something like this will work