00yoshi 0 Posted May 3, 2015 Share Posted May 3, 2015 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! Quote Link to post Share on other sites
0 Sangar 92 Posted May 3, 2015 Share Posted May 3, 2015 You want to be using `fs:write` and `fs:close` (i.e. with a colon, not a dot). You'll probably also want to use `io.open` instead of `filesystem.open`. Quote Link to post Share on other sites
0 sshika 3 Posted July 9, 2015 Share Posted July 9, 2015 when can i write in a specified line ? Quote Link to post Share on other sites
0 dgelessus 26 Posted July 9, 2015 Share Posted July 9, 2015 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. Quote Link to post Share on other sites
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