Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
Mad2k6

Can't open file in driver mode (events)

Question

So... I'm totally new to lua and I was able to write a simple program that listen in the foreground for modem_messages and depending on the message, it either responds back or write to a file. Now that I had it working in foreground (using event.pull), I wanted to have it run in driver mode (event.listen). The problem is that now it can't write to the file while in driver mode and I get a "file not found" error if I run.

print(io.open("/tmp/arp.cache", "a")) 

Since I also have a message to my assert line, I see that message appended in /tmp/events.log.

 

Driver mode code: http://pastebin.com/bbf9XuXX

 

Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0
  • Solution

I was actually able to fix it myself. It seems like I can't use the io API when in driver mode. Instead of io.open, i use filesystem.open and it works (as long as I require("filesystem") at the top of the file. I tried require("io") and require("filesystem") to use io, but it didn't work.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.