Archives
The Archives
scripting namespace contains functions for managing archives.
Functions
Overview
Archive Management
Resource Archives
Bookmarks
Misc
All
Returns
Archive[] : An array of all currently open archives
Create
Creates a new archive of the format specified in
Parameters
formatId (string ): TheArchiveFormat id to create
Returns
Archive : The created archive, ornil
if creation failedstring : An error message if creation failed
Notes
Currently only wad
and zip
formats are supported for creation.
Example
local archive, err = Archives.Create('wad')
if archive == nil then
App.LogMessage('Error creating archive: ' .. err)
end
OpenFile
Attempts to open the archive file at
Parameters
path (string ): The full path (on disk) of the archive file to open
Returns
Archive : The opened archive, ornil
if opening failedstring : An error message if opening failed
Close (1)
Closes the given
Parameters
archive (Archive ): The archive to close
Returns
boolean :false
ifarchive is invalid or not currently open
Notes
Warning
Please be careful when using the Close*
functions - attempting to access a closed archive from a script will currently cause a crash.
Close (2)
Closes the archive at All
).
Parameters
index (integer ): The index of the archive to close
Returns
boolean :false
if the givenindex is invalid
CloseAll
Closes all currently open archives.
BaseResource
Gets the currently loaded base resource archive.
Returns
Archive : The currently loaded base resource archive
BaseResourcePaths
Gets all configured base resource archive file paths.
Returns
string[] : An array of configured base resource archive file paths
Notes
This is the list of base resource archive paths as seen in the base resource configuration dialog.
OpenBaseResource
Opens the base resource archive at BaseResourcePaths
).
Parameters
index (integer ): The base resource path index to open
Returns
boolean :false
if the given index was out of range
ProgramResource
Gets the program resource archive.
Returns
Archive : the program resource archive (eitherslade.pk3
or theres
folder if you are running a dev build)
Bookmarks
Gets all currently bookmarked entries.
Returns
ArchiveEntry : An array of all currently bookmarked entries[
]
AddBookmark
Adds
Parameters
entry (ArchiveEntry ): The entry to bookmark
RemoveBookmark
Removes
Parameters
entry (ArchiveEntry ): The entry to un-bookmark
Returns
boolean :false
if the givenentry was not currently bookmarked
FileExtensionsString
Gets an extension filter string for all supported archive file types.
Returns
string : The extension filter string for all supported archive file types
Notes
See UI.PromptOpenFile
and the Open Archive example for more information.
RecentFiles
Gets all recently opened archive file paths.
Returns
string[] : An array of file paths to recently opened archives
EntryType
Gets the entry type with the given
Parameters
id (string ): The id of theEntryType to get
Returns
EntryType : The entry type with the givenid , ornil
if no type has that id
Example
-- Will write 'Wad Archive' to the log
local type = Archives.EntryType('wad')
App.LogMessage(type.name)