Jump to content




Bulletin-attempt to call nil


  • You cannot reply to this topic
4 replies to this topic

#1 gollark8

  • Members
  • 207 posts

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 by gollark8, 31 December 2013 - 09:09 AM.


#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

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?

#3 CometWolf

  • Members
  • 1,283 posts

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

#4 gollark8

  • Members
  • 207 posts

Posted 31 December 2013 - 09:08 AM

View PostBomb Bloke, on 31 December 2013 - 08:44 AM, said:

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.

#5 CometWolf

  • Members
  • 1,283 posts

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





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users