Project archives

With the release of Luxinia R.98, projects can be distributed as single file releases. The project archives are simple zip files, containing all the scripts and resources that are required for executing the project.

All you need is the windows explorer (or another filemanager of your choice) and a ZIP utility to compress the directory structure of your project.

As for this example, we are using the picking tutorial

The tutorial project folder contains these files here:

main.lua
textures
t33small.tga
models
t33.f3d

These files must now be zipped into a single zip archive. Important: the main.lua file must reside in the top folder of the zip.

The given content can be downloaded here:

Once the directory has been zipped, we simply rename the file, using the suffix .lxz. If Luxinia is started with a lxz file as argument, it will automatically add the zip to its search directories and browse through it when it tries loading files or browsing directories.

How does it work?

The VFSmapper? class (virtual filesystem mapper) allows loading files and scripts from zip archives once they are added to the list of zip archives.

The function addZip of this class will add any zip archive to the list that is going to be looked for. Additionally to loading resources or scripts from zip archives, the lua filesystem lib is patched in order to read directories inside the zip archive just like normal directories. As long as your code is not accessing the files in your project directly using the io lib of lua, your code should just run fine.

You will however notice that you can no longer rely on having a projectdirectory that can be used to store data like scores or savegames. Due to this need, .98 introduces the DataRegistry? class which allows you to save data in a predefined directory which is guaranteed to work even if your project is zipped in an archive. You can read more on this in the Saving data tutorial.