I followed the tutorial about receiving GPS coordinates from the iOS: "How do I use CoreLoction with iOS"
All of that worked properly on the first run!
So I was thinking about extending the features a bit, calculating the difference in lat/lon based on the most recent two sets of lat/long received.
based on the article, I already had an array called tLocation. It has six elements (lat, lon, horizontal accuracy, altitude, vertical accuracy, and timestamp)
I put those elements into tLocation["now"]. I wanted to copy them into tLocation["then"], and then overwrite what was in tLocation["now"] with the newest location data.
Here's the code I'm using:
Code: Select all
on locationChanged
--get new location
put empty into field "monitor"
local tLocation
put iphoneCurrentLocation() into tLocation["now"]
--display returned location
put displayArrayData(tLocation) into field "monitor"
put tLocation["now"]["latitude"] into fld "Lat"
put tLocation["now"]["longitude"] into fld "Long"
put tLocation["now"]["horizontal accuracy"] into fld "HA"
put tLocation["now"]["altitude"] into fld "Alt"
put tLocation["now"]["vertical accuracy"] into fld "VA"
put tLocation["now"]["timestamp"] into tStamp
convert tStamp to short date and long time
put tStamp into fld "Time"
--push new location into old location's slot
put tLocation["now"] into tLocation["then"]
I'm pretty confident that I have the syntax right for copying one part of an array into another part, but it's just not working here.
Anyone have some ideas? I'm new to LiveCode, and surprised that I'm bumping my head on this problem.