Advertisement
guitarplayer616

OpenWirelessSpeaker

Dec 14th, 2019
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.60 KB | None | 0 0
  1. args = tonumber(...)
  2. component = require("component")
  3. computer = require("computer")
  4. m = component.proxy(component.list("modem")())
  5. m.open(2412)
  6.  
  7. while true do  
  8.   local evt,_,_,_,_,cmd = computer.pullSignal()
  9.   if evt == "modem_message" then
  10.     local count = 1
  11.     --find if it has multiple
  12.     --local hasMultiple = 0
  13.     --if cmd:find("%g+%s%g+") then
  14.     --  hasMultiple = 1
  15.     --end
  16.     for word in cmd:gmatch("%g+") do
  17.         if count == args then
  18.             --io.write(cmd)
  19.             --io.write(" ")
  20.             --print(hasMultiple)
  21.             load(word)()
  22.         end
  23.         count = count + 1
  24.     end
  25.   elseif evt == "key_up" then
  26.     break
  27.   end
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement