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

Question

When i try to save files with the Filesystem and the Filestream from Filesystem.open i get following error:

 

/lib/filesystem.lua:467: attempt to index local 'self' (a nil value)

stack traceback:

            kernel:730: in function '__index'

            /lib/filesystem.lua:467: in function 'close'

            stdin:1: in main chunk

            [C]: in function 'xpcall'

            kernel: 725: in function 'xpcall'

            /bin/lua.lua:62: in main chunk

           (...tail calls...)

 

I typed this in lua console:

fs = filesystem.open("/mnt/da0/adsfk","w")    --da0 is HDD

fs.write("something")

fs.close() --here it happens

 

Any help is appreciated!

Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Files don't know "lines", they are a sequence of bytes. You can use file:seek(pos) to move the current position, then the file:read and file:write functions will start reading/writing from that position. (Note that those two functions also move the current position to where they stopped reading/writing.) You'll need to manually find where line breaks ("\n") are though.

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.