App
The App
scripting namespace contains a set of functions for general interaction with the SLADE application.
Functions
logMessage
string message : The message to print to the log
Writes a message to the SLADE log.
Example
App.logMessage('This is a log message')
globalError
Returns
Returns the most recently generated error message
messageBox
string title : The dialog captionstring message : The message to display
Shows a simple message dialog
messageBoxExt
string title : The dialog captionstring message : The message to displaystring detail : The detailed message to display
Shows an extended message box with an extra scrollable text box displaying
promptString
string title : The dialog captionstring message : The message to displaystring default_value : The initial default value
Returns
Shows a dialog prompt for the user to enter a string value
promptNumber
string title : The dialog captionstring message : The message to displaynumber default_value : The initial default valuenumber min : The minimum value allowednumber max : The maximum value allowed
Returns
Shows a dialog prompt for the user to enter a numeric value
promptYesNo
string title : The dialog captionstring message : The message to display
Returns
Shows a dialog prompt with 'Yes' and 'No' buttons, returning true
for yes or false
for no
browseFile
string title : The dialog captionstring extensions : A formatted list of selectable file extensions (see description for format)string filename : The name of the file to browse for
Returns
Shows a file browser dialog allowing the user to select a file and returns the full path to the selected file. If no file was selected it will return an empty
The extensions parameter must be in the following format:
[Type Name 1]|[Extension 1]|[Type Name 2]|[Extension 2]|...
Where Type Name X
is the name to display in the type selection dropdown, and Extension
is the wildcard file extension for that type. For an example see below
Example
local path = App.browseFile('Select a File', 'Wad Files (*.wad)|*.wad|All Files|*.*', '') App.logMessage('Selected file ' .. path)
browseFiles
string title : The dialog captionstring extensions : A formatted list of selectable file extensions
Returns
Shows a file browser dialog allowing the user to select multiple files and returns an array of full paths to the selected files. If no file was selected it will return an empty array. See browseFile above for the formatting of the
currentArchive
Returns
Returns the archive for the currently open tab in the main SLADE window.
currentEntry
Returns
Returns the currently open entry in the main SLADE window.
currentEntrySelection
Returns
Returns an array of the currently selected entries in the main SLADE window.
showArchive
Archive archive : The archive to show
Shows the tab for the given archive in the main SLADE window.
showEntry
ArchiveEntry entry : The entry to show_
Shows the given entry in a tab in the main SLADE window.
mapEditor
Returns
Returns the currently open map editor