Jump to content




rednet.receive() timeout not working?

lua wireless

2 replies to this topic

#1 throwaway4140

  • New Members
  • 2 posts

Posted 20 July 2018 - 01:32 AM

Hello,

Whenever I try to specify the timeout in rednet.receive() it gives me the following error which I think is a bug:

startup.lua:38: bad argument #2 (expected number, got number)

This is the code I'm using. It's asks the turtles with ids 0,1,2,3,4 for their status.

if command == "next" then
  readyTurtles = 0

  for i = 0, 4 do
   id = 5
   rednet.send(i,"status")
   id,msg,protocol = rednet.receive(2)
  
   if id == i then
	print("ID " .. id .. ": ready")
	readyTurtles = readyTurtles + 1
   else
	print("ID " .. i .. ": not ready")
   end
  end

  if readyTurtles == 5 then
   rednet.broadcast("1337")
  end

else
  rednet.broadcast(command)
end

Using ComputerCraft1.80pr1

I have no clue what I'm doing wrong here, as the wiki does the same thing.

#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 20 July 2018 - 02:34 AM

It's a bug in the pre-release version of ComputerCraft you're using. It's fixed in later builds, check the links through my signature.

#3 throwaway4140

  • New Members
  • 2 posts

Posted 20 July 2018 - 12:00 PM

View PostBomb Bloke, on 20 July 2018 - 02:34 AM, said:

It's a bug in the pre-release version of ComputerCraft you're using. It's fixed in later builds, check the links through my signature.

Thank you so much! I thought I was running the latest version since I downloaded the mod using the Twitch launcher.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users