Functions - Windower/Lua GitHub Wiki
This page lists Windower-specific functions available through Lua. All of them are restricted to the windower
table and will be accessed through it. The following is a listing for all available functions directly inside the windower
table. For further nested packets, see one of these pages:
- FFXI - FFXI-related functions
- Text - Functions that create and modify text objects
- Prim - Functions that create and modify image primitives
- Packets - Functions that inject packets
- Regex - Regex related functions
- Console - Functions regarding the Windower console
- Chat - Functions regarding the FFXI chat input
An honorable mention go to print
, which is exposed globally. It's the same as Lua's internal print
, but it will output to the Windower console.
Furthermore, two functions are added to the coroutine
table:
-
co
thread - Coroutine to be closed
This will close the provided coroutine co
, preventing it from executing again. This is needed to terminate coroutine loops and is the only way to close them from outside the coroutine. A closed coroutine can not be resumed again.
-
fn
function - Function to be scheduled -
time
number - Time in seconds whenfn
is supposed to be run
Executes fn
delayed by time
seconds. Returns the scheduled coroutine.
-
time
number - Time in seconds
Sleeps the current evaluation for the given period of time.
This table contains all Windower-specific functions.
-
mode
integer - Chatmode to use. -
msg
string - Message to write. This function outputs to the chatlog. The chatmode argument roughly corresponds to color; take a look at the spellcast color test XML to see what these values look like.
-
path
string - The path to the folder Creates the final directory in the path. Will throw an error (return false and an error message) if one of the middle directories does not exist.
-
str
string - Input string optionally containing auto-translated blocks
Removes all auto-translate formatting, if present, from the input string.
-
str
string - String to copy
Copies the provided string to the clipboard for use outside of FFXI (or to paste into the chatlog/console).
-
...
any - Any number/type of arguments to be printed
Prints all its arguments to the debug lock, prepended by the thread ID and addon name.
-
path
string - The path to the folder
Checks if the path is a valid directory address. Returns true or false.
-
file
string - The path to the file -
arguments
table - List of arguments to pass
Executes a file on the system. Activity remains on the current window.
-
path
string - The path to the file
Checks if the path is a valid file address. Returns true or false.
-
str
string - Input string optionally containing%
-variables Takes a string and replaces all occurrences of%
-variables (%area
,%target
, etc.).
-
str
string - The string to convert
Converts a Shift_JIS (FFXI flavor) string to a UTF-8 string used by addons and Windower in general (including the provided resources). This will rarely need to be used, as text read from the chatlog is already translated to UTF-8 before being passed to the incoming and outgoing text events.
-
path
string - The path to the directory
Returns a table containing all files and directories within one directory.
Returns a string containing the contents of the clipboard, if applicable, otherwise returns nil.
Returns the currently set ingame chat filters.
Returns a table of the user's Windower settings. The structure is as follows:
{
x_res: int
y_res: int
ui_x_res: int
ui_y_res: int
launcher_version: number
window_x_pos: int
window_y_pos: int
}
-
url
string - URL to open. This function opens a URL in the default browser. Similar to chatmon, it suffers the same limitation of some incompatibility, particularly with Firefox.
-
path
string - The path to the file Plays a sound at the specified file path. Currently, .wav is the only accepted format.
-
name*x*
string - Event name -
fn
function - Function to execute whenever the event is triggered Registers a function to execute whenever an event triggers. If multiple names are provided, one function will be assigned to all those events.
Returns the IDs of registered functions, which can be used to unregister them again (see below).
-
str
string - Command to send. This function is used to send a command to Windower. This command is treated as if it were entered into the windower console, so no//
prefix is necessary.
-
msg
string - Message to send. This function sends an IPC message to all other Windower instances that have the same addon loaded. This message is handled by theipc message
event.
-
id
integer - ID of the mob -
name
string - New name to set for the mob This function changes the name of a mob to the string you specify. Can cause crashes. Beware.
-
str
string - The string to convert
Converts a UTF-8 string (default assumed for all addon files) to a Shift_JIS (FFXI flavor) string used by FFXI. This should be used every time non-ASCII characters are supposed to be output to the chatlog.
-
id*x*
integer - ID of the event to unregister Stops a function from being executed by an event. The ID of the function is returned on registering the it withwindower.register_event
.
-
str
string - Input string to match -
pattern
string - Pattern to match against
Returns true if str
matches pattern
. Allowed tokens:
-
?
matches any one character -
*
matches arbitrary many characters -
|
alternation, matches either the left of it or the right of it
Returns true if instance has focus, false if it does not.
Takes the focus from any application, if instance already has focus does nothing.
This table also contains the following variables:
windower_path
string
- Path to the current Windower installation (includes final slash)
addon_path
string
- Path to the currently loaded addon directory (includes final slash)
pol_path
string
- Path to playonline and ffxi install directory (includes final slash)