Lysa  0.0
Lysa 3D Engine
VirtualFS Class Referenceabstract

Detailed Description

Virtual filesystem that maps URI schemes (e.g. `app://`) to real paths.

Lua full name: lysa.VirtualFS

Public Member Functions

string get_path (p: string)
 Resolves a virtual path (e.g. 'app://res/model.assets') to a real filesystem path. More...
 
boolean file_exists (p: string)
 Returns true if a file exists at the given virtual path. More...
 
boolean directory_exists (p: string)
 Tests whether a directory exists at the given path or URI. More...
 
string load_string (p: string)
 Loads the content of a file as a string from the configured script directory. More...
 
nil for_each_directory_entry (uri: string, handler: fun(type:integer, name:string))
 Iterates over the entries of a directory, calling the handler for each entry with its type (see lysa.DirectoryEntryType) and its path relative to uri. More...
 
nil for_each_directory_entry (uri: string, handler: fun(type:integer, name:string), recursive: boolean)
 Iterates over the entries of a directory, recursively if requested, calling the handler for each entry with its type (see lysa.DirectoryEntryType) and its path relative to uri. More...
 

Properties

string script_directory
 Path to the configured Lua script directory. (read-only)
 
boolean use_resources_pack
 True if the virtual FS serves assets from a binary resource pack instead of loose files. (read-only)
 

Member Function Documentation

string get_path ( string  p)

Resolves a virtual path (e.g. 'app://res/model.assets') to a real filesystem path.

Parameters
pstring
Returns
string
boolean file_exists ( string  p)

Returns true if a file exists at the given virtual path.

Parameters
pstring
Returns
boolean
boolean directory_exists ( string  p)

Tests whether a directory exists at the given path or URI.

Parameters
pstring
Returns
boolean
string load_string ( string  p)

Loads the content of a file as a string from the configured script directory.

Parameters
pstring
Returns
string
nil for_each_directory_entry ( string  uri,
fun(type:integer, name:string)  handler)

Iterates over the entries of a directory, calling the handler for each entry with its type (see lysa.DirectoryEntryType) and its path relative to uri.

Parameters
uristring
handlerfun(type:integer, name:string)
nil for_each_directory_entry ( string  uri,
fun(type:integer, name:string)  handler,
boolean  recursive)

Iterates over the entries of a directory, recursively if requested, calling the handler for each entry with its type (see lysa.DirectoryEntryType) and its path relative to uri.

Parameters
uristring
handlerfun(type:integer, name:string)
recursiveboolean

Property Documentation

string script_directory

Path to the configured Lua script directory. (read-only)

boolean use_resources_pack

True if the virtual FS serves assets from a binary resource pack instead of loose files. (read-only)