File Objects

From OxeyeWiki

Jump to: navigation, search
DaisyMoon File Objects

DaisyMoon contains classes for writing and reading binary files. These can be useful if you want to have greater 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.

Note: This mode will only compress the data to save disk space, the written file will not be a valid zip archive.

In Memory (m)

You can also use the file objects to serialize things in memory (without writing to disk).

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox