Mods
What every mod has: mod, log, print, persist, storage, require and raw.
mod
Type name: WaxModInfo.
| Member | Type | Description |
|---|---|---|
id | string | The mod's folder name. |
name | string | |
version | string | |
dir | string | Path of the mod's folder. |
log
The mod's own log channel. Values after fmt are put into it with string.format.
Type name: WaxLogger.
| Member | Type | Description |
|---|---|---|
channel | string | The mod's id. |
log:trace(fmt, ...)
Logs at trace level, which the default log level drops.
log:trace(fmt: any, ...: any): WaxLogEntry?| Parameter | Type |
|---|---|
fmt | any |
... | any |
Returns WaxLogEntry?
log:debug(fmt, ...)
Logs at debug level.
log:debug(fmt: any, ...: any): WaxLogEntry?| Parameter | Type |
|---|---|
fmt | any |
... | any |
Returns WaxLogEntry?
log:info(fmt, ...)
Logs at info level.
log:info(fmt: any, ...: any): WaxLogEntry?| Parameter | Type |
|---|---|
fmt | any |
... | any |
Returns WaxLogEntry?
log:warn(fmt, ...)
Logs a warning.
log:warn(fmt: any, ...: any): WaxLogEntry?| Parameter | Type |
|---|---|
fmt | any |
... | any |
Returns WaxLogEntry?
log:error(fmt, ...)
Logs an error, which also shows as a notification in the game.
log:error(fmt: any, ...: any): WaxLogEntry?| Parameter | Type |
|---|---|
fmt | any |
... | any |
Returns WaxLogEntry?
storage
Settings that survive restarting the game, kept in one small file per name.
Type name: WaxStorage.
storage.Load(name, defaults?)
Returns a copy of defaults with whatever was saved under name laid over it.
storage.Load<T: table>(name: string, defaults?: T): T
storage.Load(name: string): table| Parameter | Type | Description |
|---|---|---|
name | string | Letters, digits, _ and - only. |
defaults (optional) | T |
Returns T
storage.Save(name, value)
Queues the table to be written under name. Only numbers, strings, booleans and tables of them are kept.
storage.Save(name: string, value: table)| Parameter | Type | Description |
|---|---|---|
name | string | Letters, digits, _ and - only. |
value | table |
Returns nothing.
Global functions
Call these by name, with nothing in front.
print(...)
Logs the values, joined by tabs, at info level on the mod's channel.
print(...: any)| Parameter | Type |
|---|---|
... | any |
Returns nothing.
persist(key, default?)
Returns the value kept under key, storing default (or a new table) on first use. The value survives reloads of the mod.
persist<T>(key: string, default?: T): T
persist(key: string): table| Parameter | Type |
|---|---|
key | string |
default (optional) | T |
Returns T
require(name)
Loads a file of this mod ("sub.name" is sub/name.lua or sub/name/init.lua), or another mod's exports with "@Id".
require(name: string): any| Parameter | Type |
|---|---|
name | string |
Returns any
Global values
raw
The real global table: unguarded access to everything UE4SS offers, including what Wax blocks.
Type table<string, any>
WaxManifest
What a mod's mod.lua returns. The file is optional, and so is every field.
| Field | Type | Description |
|---|---|---|
name (optional) | string | Display name. The folder name when omitted. |
version (optional) | string | "0.0.0" when omitted. |
main (optional) | string | Entry file inside the mod's folder. "init.lua" when omitted. |
dependencies (optional) | string[] | Ids of mods that load first. Each can then be reached with require("@Id"). |
WaxLogEntry
One line of the Wax log.
Returned by log:trace, log:debug, log:info, log:warn, log:error.
| Field | Type | Description |
|---|---|---|
id | integer | |
time | integer | |
level | "trace" | "debug" | "info" | "warn" | "error" | |
channel | string | |
message | string | |
count | integer | How many times in a row this message was logged. |
Blocked functions
These UE4SS functions raise an error when a mod calls them. The reason is given for each one.
| Function | Note |
|---|---|
LoopAsync | Blocked in Wax mods: it runs Lua on another thread, which corrupts the game's Lua state. Use task.spawn or task.delay. |
ExecuteAsync | Blocked in Wax mods: it runs Lua on another thread, which corrupts the game's Lua state. Use task.spawn or task.delay. |
ExecuteWithDelay | Blocked in Wax mods: it runs Lua on another thread, which corrupts the game's Lua state. Use task.spawn or task.delay. |
RegisterKeyBind | Blocked in Wax mods: it runs Lua on another thread, which corrupts the game's Lua state. Use ui.Hotkey. |
RegisterKeyBindAsync | Blocked in Wax mods: it runs Lua on another thread, which corrupts the game's Lua state. Use ui.Hotkey. |
RestartMod | Blocked in Wax mods: restarting a UE4SS mod destroys the Lua state Wax runs in. Reload the mod through Wax instead. |
RestartCurrentMod | Blocked in Wax mods: restarting a UE4SS mod destroys the Lua state Wax runs in. Reload the mod through Wax instead. |
UninstallMod | Blocked in Wax mods: it destroys the Lua state Wax runs in. |
UninstallCurrentMod | Blocked in Wax mods: it destroys the Lua state Wax runs in. |
ClearAllDelayedActions | Blocked in Wax mods: it cancels every mod's timers, and Wax's own frame loop with them. |