File Objects

From OxeyeWiki

(Difference between revisions)
Jump to: navigation, search
(Compressed on Disk (z))
 
(One intermediate revision not shown)
Line 1: Line 1:
{{File}}
{{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 works with strings and doubles in normal cases.
+
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: [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]
Line 16: Line 16:
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.
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) ===
=== In Memory (m) ===
You can also use the file objects to serialize things in memory (without writing to disk).
You can also use the file objects to serialize things in memory (without writing to disk).

Latest revision as of 10:19, 8 February 2010

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