rednet.open(back, true)
function gettingNews()
while true do
message = rednet.recieve()
end
end
x = message
function displayingNews()
while true do
textutils.slowWrite(x, 5)
end
end
parallel.waitForAny(gettingNews(), displayingNews())
displayingNews()
help i cant find string
Started by cmurtheepic, Nov 23 2012 12:35 PM
6 replies to this topic
#1
Posted 23 November 2012 - 12:35 PM
my program keeps saying string expected
#2
Posted 23 November 2012 - 12:38 PM
It expects a string at the first line:
In your code, it's looking for a variable named back which is nil, while it actually needs the string 'back'.
rednet.open('back', true)
instead of:rednet.open(back, true)
In your code, it's looking for a variable named back which is nil, while it actually needs the string 'back'.
#3
Posted 23 November 2012 - 12:43 PM
Orwell, on 23 November 2012 - 12:38 PM, said:
It expects a string at the first line:
In your code, it's looking for a variable named back which is nil, while it actually needs the string 'back'.
rednet.open('back', true)
instead of:rednet.open(back, true)
In your code, it's looking for a variable named back which is nil, while it actually needs the string 'back'.
Edit: message hasn't been declared yet when you do 'x = message', you might just wanna do this:
rednet.open(back, true) local message = "" -- set to "" to make sure that it isn't nil when displayingNews uses it function gettingNews() while true do message = rednet.recieve() end end function displayingNews() while true do textutils.slowWrite(message, 5) end end parallel.waitForAny(gettingNews, displayingNews)
Also, you should pass the function variables to parallel.waitForAny, not the result of the function calls. So rather my correction above than this:
parallel.waitForAny(gettingNews(), displayingNews())
Actual edit: How could I've pressed the wrong button..?
#4
Posted 23 November 2012 - 02:14 PM
ok now it is saying that
help?
message = rednet.recieve()is nil
help?
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











