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

parallel API question

Started by vincoreprograms, 23 December 2014 - 08:12 PM
vincoreprograms #1
Posted 23 December 2014 - 09:12 PM
So I want to receive a message while doing a mouse_click function and I want to be able to receive multiple messages at once and yet be able to do the mouse_click function.

How could I do that?
KingofGamesYami #2
Posted 23 December 2014 - 11:13 PM
http://computercraft.info/wiki/Rednet_message_%28event%29


while true do
  local event = { os.pullEvent() }
  if event[ 1 ] == "rednet_message" then
    local id, msg = event[ 2 ], event [ 3 ]\
    --#do stuff
  elseif event[ 1 ] == "mouse_click" then
    --#do stuff
  end
end