This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
corisco1917's profile picture

[Question] executing something after gps.locate() returns

Started by corisco1917, 07 February 2013 - 03:45 PM
corisco1917 #1
Posted 07 February 2013 - 04:45 PM
the question makes no sense… sorry –edit

admins: delete this post if you want.
Kingdaro #2
Posted 07 February 2013 - 05:01 PM
First off, you probably shouldn't be naming your variable "table", as it could overwrite an important API. Even if it's local, you won't be able to use said API within the scope of the variable.

Also, you're setting the location to an empty table right after inserting the coordinates, and you're putting it into it's own empty table. Not sure why.

Here's a new code:

rednet.open("right")
local x,y,z = gps.locate(5)
local coords = {}
coords.location = {x=x, y=y, z=z}
coords.type = "turtle"
coords.action = "save"
Stable = textutils.serialize(table)
rednet.broadcast(Stable)
corisco1917 #3
Posted 07 February 2013 - 05:09 PM
thanks Kingdaro, very usefull tips.
Cranium #4
Posted 07 February 2013 - 06:30 PM
Locked upon request.