Archive
The Archive type represents an archive (wad/pk3/etc) in SLADE.
Properties
Property | Type | Description |
---|---|---|
The full path to the archive file on disk | ||
An array of all entries in the archive | ||
The root directory of the archive | ||
Information about the archive's format |
Constructors
No Constructors
This type can not be created directly in scripts.
Functions
getDir
string path : The path of the directory to get
Returns
Returns the directory in the archive at nil
if the path does not exist. If the archive does not support directories (eg. Doom Wad format) the 'root' directory is always returned, regardless of
createEntry
string full_path : The full path and name of the entry to createnumber position : The position to insert the entry
Returns
Creates a new entry named Scripts/NewScript.txt
.
The new entry will be inserted at
Example
-- Create entry in the root directory of a zip, after all other entries newEntry = zip:createEntry('InRoot.txt', -1) -- Create entry in a subdirectory of a zip, before all other entries in the subdirectory newEntry = zip:createEntry('Path/To/NewEntry.txt', 0) -- Create entry in the middle of a wad somewhere newEntry = wad:createEntry('NEWENTRY', 12)
createEntryInNamespace
string name : The name of the entrystring namespace : The namespace to add the entry to
Returns
Creates a new entry named
See below for a list of supported namespaces:
Namespace | Wad Archive Markers | Zip Archive Directory |
---|---|---|
patches |
P_START / P_END |
patches |
sprites |
S_START / S_END |
sprites |
flats |
F_START / F_END |
flats |
textures |
TX_START / TX_END |
textures |
hires |
HI_START / HI_END |
hires |
colormaps |
C_START / C_END |
colormaps |
acs |
A_START / A_END |
acs |
voices |
V_START / V_END |
voices |
voxels |
VX_START / VX_END |
voxels |
sounds |
DS_START / DS_END |
sounds |
removeEntry
ArchiveEntry entry : The entry to remove
Returns
Removes the given entry from the archive (but does not delete it). Returns false
if the entry was not found in the archive.
renameEntry
ArchiveEntry entry : The entry to renamestring name : The new name for the entry
Returns
Renames the given entry. Returns false
if the entry was not found in the archive.
save
[
string path ]
: The full path to the file to save as
Returns
Saves the archive to disk. If no
If
Example
-- Open an archive local archive = Archives.openFile('c:/filename.wad') App.logMessage(archive.filename) -- 'c:/filename.wad' -- Save as new file archive:save('c:/newfile.wad') App.logMessage(archive.filename) -- 'c:/newfile.wad'