Lua VFS: Difference between revisions
No edit summary |
Auswaschbar (talk | contribs) No edit summary |
||
| Line 28: | Line 28: | ||
( string "filename" [, number mode ], lua_function [, arg1 [,arg2 ]] ) | ( string "filename" [, number mode ], lua_function [, arg1 [,arg2 ]] ) | ||
-> result1,result2,... of the given lua_function | -> result1,result2,... of the given lua_function | ||
'''VFS.MapArchive''' <font color="#55ee99">unsynced only!</font> | |||
( string "filename/modname of archive", [unsigned int checksum of archive] ) | |||
-> true if archive could be loaded, false otherwise | |||
Permanently loads an archive into the VFS. Usefull e.g. for unsyncd dependencies, liek additional music archive. | |||
== Packing == | == Packing == | ||
Revision as of 22:46, 31 August 2009
Development < Lua Scripting < Lua VFS
Modes
VFS.RAW
VFS.MOD (unimplemented, acts like VFS.ZIP)
VFS.MAP (unimplemented, acts like VFS.ZIP)
VFS.BASE (unimplemented, acts like VFS.ZIP)
VFS.ZIP
VFS.RAW_FIRST
VFS.ZIP_FIRST
VFS.RAW_ONLY (same as VFS.RAW)
VFS.ZIP_ONLY (same as VFS.ZIP)
Files
VFS.Include (if enviroment=nil then use current one)
( string "filename" [, table enviroment [, number mode ] ] ) ->
VFS.LoadFile
( string "filename" [, number mode ] ) -> nil | lstring data
VFS.FileExists
( string "filename" [, number mode ] ) -> boolean
VFS.DirList
( string "directory" [, string "pattern" [, number mode ] ] )
-> { [1] = string filename, ... }
VFS.SubDirs
( string "directory", [, string "pattern" = "*" [, number mode ] ] )
-> { [1] = string subdir1, ... }
VFS.UseArchive unsynced only!
( string "filename" [, number mode ], lua_function [, arg1 [,arg2 ]] ) -> result1,result2,... of the given lua_function
VFS.MapArchive unsynced only!
( string "filename/modname of archive", [unsigned int checksum of archive] ) -> true if archive could be loaded, false otherwise
Permanently loads an archive into the VFS. Usefull e.g. for unsyncd dependencies, liek additional music archive.
Packing
The Pack- and Unpack-functions are used to convert numbers->strings and strings->numbers. So you can read a binary file and then convert the received strings back to numbers and the other way around. Also you can use it in combination with the SendLuaXYZMsg-functions.
VFS.PackU8
VFS.PackU16
VFS.PackU32
VFS.PackS8
VFS.PackS16
VFS.PackS32
VFS.PackF32
arguments are:
VFS.PackX( number arg1, number arg2, number arg3, ... ) -> string
VFS.PackX( {[1]=number,[2]=number,..} ) -> string
VFS.UnpackU8
VFS.UnpackU16
VFS.UnpackU32
VFS.UnpackS8
VFS.UnpackS16
VFS.UnpackS32
VFS.UnpackF32
arguments are:
VFS.UnpackX( string "binary" [, number offset ] [, number count] )
-> number | table { [1]=number,[2]=number,.. }