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

parallel.waitForAny()

Started by scyost, 27 January 2014 - 11:05 AM
scyost #1
Posted 27 January 2014 - 12:05 PM
Hello, I am kinda new to computer craft. I was wondering if anyone can tell me why i keep on getting errors with the code

error : parallel :22: test:5: attempt to index ? (a function value)


r = rednet
r.open("top")
function listen()
  id,msg,dis=r.receive()
  shell.run(msg)
end
function shell()
  io.write("> ")
  io.read()
end
while true do
  parallel.waitForAny(shell, listen)
end
CometWolf #2
Posted 27 January 2014 - 12:31 PM
Because you define shell as it's own function, then attempt to call a function from the old shell table. Basically, change the name of your shell function.
scyost #3
Posted 27 January 2014 - 12:34 PM
alright, thanks!