Jump to content




Using the Filesystem in Lua Tutorial


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

#1 houseofkraft

  • Members
  • 170 posts
  • LocationUSA

Posted 31 August 2016 - 05:13 PM

So you might be asking yourself?

How do i use the file system in my program?

I know how i used to not be able to know the filesystem commands. But now i know and i want to share the same experience i know to you.

Filesystem Commands:

fs.open()

fs.exists()

fs.delete()
fs.move()
fs.copy()

There will be more filesystem tutorials later, but this is what I know right now. Thank You!

#2 TheRockettek

  • Members
  • 547 posts
  • LocationRem is best girl

Posted 31 August 2016 - 07:30 PM

Just a heards up theres 3 more modes for fs.open:

- a: Append move. Same as w (write mode) except instead of replacing e file, it will write from the end of the file.

- rb: Read (binary) mode: Same as read but returns the charactersas the codes of ids (eg: 126,46)

- rw: Write (binary) mode: Insert number, letter comes out (wrote to file) :D

Only if there was ab... Append (Binary)

#3 NotSwedishFish

  • Members
  • 6 posts

Posted 09 September 2016 - 11:53 PM

Some things to watch out for:

Just because your program works on your laptop's installation of Lua does not mean it will work in CC. For example, myfile:read("*a") will work on a normal computer, but not inside CC. It will also work in binary mode on a normal computer, but not in CC. Indeed, the API can be different, so make sure to check your FS operations.

None of the + file modes in the reference implementation of Lua will work.

Edited by NotSwedishFish, 09 September 2016 - 11:54 PM.






2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users