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

Bulletin-attempt to call nil

Started by gollark8, 31 December 2013 - 07:19 AM
gollark8 #1
Posted 31 December 2013 - 08:19 AM
oldPull = os.pullEvent
os.pullEvent = os.pullEventRaw
local bulletin = fs.open("bulletin","a")
local mon = peripheral.wrap("top") --peripheral.wrap("monitor")
mon.clear()
mon.setCursorPos(1,1)
mon.setTextScale(5)
mon.write("NEWS")
mon.setTextScale(3)
rednet.open("back")
while true do
ev, id, msg = os.pullEvent()
if ev == "rednet_message" then
bulletin.flush(id..")"..msg)
print(id..")"..msg)
mon.write(id..")"..msg)
elseif ev == "terminate" then
os.pullEvent = oldPull
bulletin.close()
shell.exit()
end
end
I get an attempt to call nil on the line
bulletin.flush(id..")"..msg)
And here's the sender code:

rednet.open("back")
while true do
rednet.broadcast(read())
end
Edited on 31 December 2013 - 08:09 AM
Bomb Bloke #2
Posted 31 December 2013 - 08:44 AM
Flush seems to be relatively new - CC 1.55, if I'm not mistaken. Which version are you using?
CometWolf #3
Posted 31 December 2013 - 08:45 AM
you forgot to specify what mode fs should open the file in.
http://computercraft.info/wiki/Fs.open
gollark8 #4
Posted 31 December 2013 - 09:08 AM
Flush seems to be relatively new - CC 1.55, if I'm not mistaken. Which version are you using?
1.58.
writeLine doesn't work either.Same error.
CometWolf #5
Posted 31 December 2013 - 10:49 AM
I see you corrected the mistake i pointed out. When opening a file with append, the file must already exist. Use fs.exist(filepath) to make sure, or just check manually