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

Rednet:350: string expected (Need help)

Started by gheotic, 26 January 2013 - 09:55 AM
gheotic #1
Posted 26 January 2013 - 10:55 AM
i keep getting this error (Rednet:350: string expected) why?

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 =)
remiX #2
Posted 26 January 2013 - 10:57 AM
try
rednet.broadcast(tostring(item))

What event is it waiting for and what are the parameters?
ChunLing #3
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.