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

gps

Started by Rougeminner, 05 April 2015 - 04:46 AM
Rougeminner #1
Posted 05 April 2015 - 06:46 AM
I am having a problem loading a gps x y z coord in to a table i tried POS = textutiles.serialize(gps.locate(3)) which didn't work for some stupid reason and i tried POS = gps.locate(3) but that just loaded x to var POS. can someone please help me.



Thanks in advance
Dog #2
Posted 05 April 2015 - 06:58 AM
I believe you need to capture the output in a table like so…

local POS = { gps.locate(3) }
POS[1] will = x
POS[2] will = y
POS[3] will = z
Rougeminner #3
Posted 05 April 2015 - 06:59 AM
Let me try that
Anavrins #4
Posted 05 April 2015 - 06:59 AM
Either do it like "local x, y, z = gps.locate(3)" or "local pos = textutils.serialize({gps.locate(3)})"
Edit: Ninja'd
Edited on 05 April 2015 - 05:00 AM
Rougeminner #5
Posted 05 April 2015 - 07:05 AM
I know about x,y,z= gps.locate() i need it to be loaded to a table. the second method seems to be workable. the server i tested my code on is offline so i can't check right now