Posted 11 June 2014 - 07:11 AM
Hi there, programming a Rednet program and i want to check if the message if from the right PC and with the correct Protocol, although this all seems to work but when i try to print the message it gives me the error of "Attempt To Concentrate Function And String"
Here is my code, if someone could tell me how to fix and what the error are and what they mean that would be great
Here is my code, if someone could tell me how to fix and what the error are and what they mean that would be great
-- Assigning Variables
i = 1
authenticate = 2
--Opening Rednet
rednet.open"bottom"
--Call To Clear Screen
function clear()
term.clear()
term.setCursorPos(1,1)
end
clear()
-- Loop
while i == 1 do
print "Waiting For Message"
id, message, protocol = rednet.receive()
function message()
print ("Message Received: " .. message .. " And Verified As Secure") -- This is the line of the Error!
sleep(3)
end
--Checks If Message Is Okay
function authority()
if id == authenticate then
print "Sender ID Verified"
print "Checking Protocol"
if protocol == "BulkHead" then
print "Protocol Matches"
message()
else
print ("Message Recieved With Invalid Protocol: " .. protocol .. " Message Ignored")
sleep(3)
end
else
print ("Message Received With Unauthentic ID: " .. id .. " ,Message Ignored")
sleep(3)
end
end
authority()
clear()
end
Edited on 12 June 2014 - 05:32 AM