Posted 09 May 2013 - 04:08 AM
Title: Bios 48 string expected, got nil
I was trying to write a chat program that chat and receive messages.
The program will loop at receiving a message until i press "enter", which then i will be able to type in a message.
In this program, everything works fine, until i press a different key other than "enter" in receiving mode.
It printed out "Please press enter to chat" then produced the following error, bios: 48 : string expected, got nil
please help, met a few hiccups but was stomped at this one
I was trying to write a chat program that chat and receive messages.
The program will loop at receiving a message until i press "enter", which then i will be able to type in a message.
In this program, everything works fine, until i press a different key other than "enter" in receiving mode.
It printed out "Please press enter to chat" then produced the following error, bios: 48 : string expected, got nil
please help, met a few hiccups but was stomped at this one
term.clear()
term.setCursorPos(1, 1)
x,y,z = rednet.receive()
print(y)
print("Please enter username")
write ("Username: ")
user = read()
rednet.send(x, "user")
rednet.send(x, user)
function chat()
sEvent, param = os.pullEvent("key")
if sEvent == "key" then
if param == 28 then
write ("Message: ")
mess = read()
rednet.send(x, "message")
rednet.send(x, user)
rednet.send(x, ": ")
rednet.send(x, mess)
else
print ("Press enter to chat")
end
end
end
while true do
x,y,z = rednet.receive(0.1)
write(y)
x,y,z = rednet.receive(0.1)
write(y)
x,y,z = rednet.receive(0.1)
print(y)
chat(0.1)
end