Advertisement
SavageCore

Computer GPS

May 15th, 2013
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.50 KB | None | 0 0
  1. function mysplit(inputstr, sep)
  2.         if sep == nil then
  3.                 sep = "%s"
  4.         end
  5.         t={} ; i=1
  6.         for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
  7.                 t[i] = str
  8.                 i = i + 1
  9.         end
  10.         return t
  11. end
  12.  
  13. rednet.broadcast("locate")
  14. local senderId, message, distance = rednet.receive() -- wait for message to come back from turtle
  15. coords = mysplit(message,"|")
  16. print("x:" .. coords[1])
  17. print("y:" .. coords[2])
  18. print("z:" .. coords[3])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement