Advertisement
jaypar

Untitled

Feb 18th, 2018 (edited)
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1. local component = require("component")
  2. local e = require("event")
  3. local m = component.modem
  4.  
  5. function modemMsg(...)
  6.  local args = {...}
  7.  local header = args[6]
  8.  local cmd = args[7]
  9.  local h = args[9]
  10.  local t = args[8]
  11.  local p = args[10]
  12.  local j = 1
  13.  
  14.   if header == "nanomachines" then
  15.   if cmd == "input" then
  16.    if h ~= nil then
  17.     e.push("msg_recieved", h, j)
  18.    end
  19.   elseif cmd == "totalInputCount" then
  20.    inputCount = t
  21.    inputs = inputCount
  22.    e.push("updated_inputs", inputs)
  23.   elseif cmd == "port" then
  24.  
  25.   elseif cmd == "effects" then
  26.    if t ~= "{}" then
  27.     s = string.gsub(t, "}", "")
  28.     s = string.gsub(s, "{", "")
  29.     print(s)
  30.     s = {s, j}
  31.     j = j + 1
  32.     table.insert(inList, s)
  33.     print("Effects Updated")
  34.     e.push("effects_updated", inList)
  35.    else
  36.     print("Effects Updated")
  37.     e.push("effects_updated", inList)
  38.    end
  39.   else
  40.    print(cmd)
  41.   end
  42.  end
  43. end
  44.  
  45. function eTable(...)
  46.  local args = {...}
  47.  _, inList = args
  48. end
  49.  
  50. e.listen("modem_message", modemMsg)
  51. e.listen("effects_table", eTable)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement