Jump to content




Rednet:350: string expected (Need help)


  • You cannot reply to this topic
2 replies to this topic

#1 gheotic

  • Members
  • 64 posts
  • LocationDenmark

Posted 26 January 2013 - 10:55 AM

i keep getting this error (Rednet:350: string expected) why?

Quote

term.clear()
term.setCursorPos(1,1)


rednet.open("right")
m = peripheral.wrap("top")

while true do

event, item, amount = os.pullEvent()


rednet.broadcast(item)

print("Item: "..item)
print("Amount: "..amount)

m.sort(2)

end


any help would be appreciated =)

#2 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 26 January 2013 - 10:57 AM

try
rednet.broadcast(tostring(item))

What event is it waiting for and what are the parameters?

#3 ChunLing

  • Members
  • 2,027 posts

Posted 26 January 2013 - 11:26 AM

The tostring(item) patch should avoid the error for a lot of common events, but it won't work for all of them, and you probably only want to pull a given type of event (with this code, I suspect a char event, which is always going to be preceded by a key event).

If you don't filter the event type, then the tostring(item) may keep this code from erroring, but the receivers will be getting spurious messages that may cause unexpected behavior.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users