Hi,
I have a scene that do a GET web request and get X responses back. I take that response and add it to a textbox as text. That part works. But instead of adding all text to a textbox I would like to do a “foreach” loop, and read GPS long/lat from each response and run a “add marker to mapview” command.
How do I create a foreach loop in Corona SDK? I have found a number of for 1 to 20 examples, but I never now number of events I get back from the web service.
Thanks
network.request( "http://XX.XX.XX.XX/api/v2/cstri-sitrap/\_table/cstri.sitrap?filter=alliance%20%3D%20NAF", "GET", handleResponse, params )
local json = require( "json" ) local mime = require( "mime" ) local function handleResponse( event ) if not event.isError then local response = json.decode( event.response ) defaultBox.text = event.response else print( "######## Error ############" ) end return end