Advertisement
Jakey4543

phonetest

Jan 16th, 2022 (edited)
1,809
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local ports = {
  2.     ["serverport"] = 8080,
  3.     ["phoneport"] = 8081
  4. }
  5.  
  6. local modem = peripheral.wrap("back")
  7. modem.open(ports.phoneport)
  8.  
  9. function printTable(t)
  10.     local finalstring = ""
  11.     for _,v in ipairs(t) do
  12.         finalstring = finalstring..v..","
  13.     end
  14.  
  15.     finalstring = string.sub(finalstring,1,#finalstring-1)
  16.     return finalstring
  17. end
  18.  
  19. function formatargs(args)
  20.     local final = {}
  21.     final["startPos"] = vector.new(args[1],args[2],args[3])
  22.     final["endPos"] = vector.new(args[4],args[5],args[6])
  23.     return final
  24. end
  25.  
  26. function vectorToString(vector)
  27.     local str = ""
  28.     str = str..vector.x.." "..vector.y.." "..vector.z
  29.  
  30.     return str
  31. end
  32.  
  33. -- print(printTable(arg))
  34. local finalargs = formatargs(arg)
  35.  
  36. finalargs = vectorToString(finalargs.startPos).." "..vectorToString(finalargs.endPos)
  37. modem.transmit(ports.serverport,ports.phoneport,finalargs)
  38.  
  39. event, side, senderChannel, replyChannel, msg, distance = os.pullEvent("modem_message")
  40.  
  41. print(msg)
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement