File Objects
From OxeyeWiki
(Created page with '{{File}} DaisyMoon contains classes for writing and reading binary files. These can be useful if you want to have creater control over the file structure, as Lua generally only ...') |
|||
Line 4: | Line 4: | ||
If you only want to write text to the file, it is recommended that you use the standard IO Lua library instead: [http://lua-users.org/wiki/IoLibraryTutorial Lua IO Tutorial] | If you only want to write text to the file, it is recommended that you use the standard IO Lua library instead: [http://lua-users.org/wiki/IoLibraryTutorial Lua IO Tutorial] | ||
+ | |||
+ | == File Modes == | ||
+ | |||
+ | The file objects can handle three different modes of writing and reading. This is chosen by giving different settings when creating the file objects. | ||
+ | |||
+ | === File on Disk (f) === | ||
+ | |||
+ | This is the default behaviour. The data will be written or read from a binary file on disk. | ||
+ | |||
+ | === Compressed on Disk (z) === | ||
+ | |||
+ | When writing a compressed file, all data will first be written into memory and then compressed (as a zip) before being written to disk. When reading a compressed file, the whole file will be read into memory and then unpacked. | ||
+ | |||
+ | === In Memory (m) === | ||
+ | |||
+ | You can also use the file objects to serialize things in memory (without writing to disk). |
Revision as of 18:29, 7 February 2010
DaisyMoon File Objects |
---|
DaisyMoon contains classes for writing and reading binary files. These can be useful if you want to have creater control over the file structure, as Lua generally only works with strings and doubles in normal cases.
If you only want to write text to the file, it is recommended that you use the standard IO Lua library instead: Lua IO Tutorial
Contents |
File Modes
The file objects can handle three different modes of writing and reading. This is chosen by giving different settings when creating the file objects.
File on Disk (f)
This is the default behaviour. The data will be written or read from a binary file on disk.
Compressed on Disk (z)
When writing a compressed file, all data will first be written into memory and then compressed (as a zip) before being written to disk. When reading a compressed file, the whole file will be read into memory and then unpacked.
In Memory (m)
You can also use the file objects to serialize things in memory (without writing to disk).