Class: VFSmapper

LuxModule: luxinialuacore

The Virtual File System mapper package provides access on files by which may either exist in directories of the harddisc or in zip file archives. Overloads loadfile/dofile in order to load lua source code from zip archives as well. Further filehandlers can be added during runtime which allows loading files from different locations (i.e. Network) as well.

Methods:

Method overview:


addCallback (function func)
returns: (function func)

adds a callback function that is called when a file should be loaded. It receives two arguments: the filname to be looked for and a boolean value if it should be read and returned:

 function func (filename, read)
   return read and (read the file content) or (true if it exists)
 end
If the function returns nil (nothing), further callback functions are called. If it returns false, it is assumed that the file does not exist. If it returns true, the file exists and it should be possible to return the content as well if needed.

Luxinia checks if a file exists before it trys to open it. If this callback returns true, it MUST be able to return the filecontent if requested. Otherwise Luxinia might crash. This callback might be extended in near future to determine the filetype as well by returning the filetype.
addZip (file)
returns: (result,[error])
adds a file to the list of zip archives that are browsed for requested files. If the given file could not be opened as zip file, it returns false and the reported error string.
dir (dirname)
returns: (func iterator)
iterates the content of the given directoryname. Even if the directory does not exist, it will return a function that returns nil. Overloads lfs/FileSystem.dir to use this function.
removeCallback (function func)
returns: ()
removes the given function from the callback list.
removeZip (file)
returns: ()
remove a zipfile from the list
ziploader (file,read)
returns: (exists/filecontent)
callback function for that is automaticly added to the list of callbacks. Handles the zipfile loading.