Posted 20 January 2013 - 04:48 PM
So I have set up a computer for a money system I have created on my server that is supposed to log interactions and communicates with the stores.
Thanks! :D/>
Also, sorry if this has a bad title, I couldn't think of anything.
local senderId, message = rednet.receive()
if message == "Alex" then
money = 100
print(message)
elseif message == "David" then
money = 20000
rednet.send(senderId, money)<------------------------------Line seven
print(message)
end
senderId, message = rednet.receive()
if senderId == 33 then
store = "Store1"
if message == "Coffee" then
print("A "..message.." was bought from "..store)
elseif message == "Cookie" then
print("A "..message.." was bought from "..store)
end
elseif senderId == 41 then
store = "Store2"
else
store = "Unknown"
end
However when the computer gets a message from a store it presents me with the error: "rednet:350: string expected" This only happens after I add line 7. I was thinking that it was because the variable "senderId" is defined outside of the if statement, but that is probably not correct. Could someone please tell me what I am doing wrong? Help is appreciated!Thanks! :D/>
Also, sorry if this has a bad title, I couldn't think of anything.