Wax

Mods

What every mod has: mod, log, print, persist, storage, require and raw.

mod

Type name: WaxModInfo.

MemberTypeDescription
idstringThe mod's folder name.
namestring
versionstring
dirstringPath 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.

MemberTypeDescription
channelstringThe mod's id.

log:trace(fmt, ...)

Logs at trace level, which the default log level drops.

log:trace(fmt: any, ...: any): WaxLogEntry?
ParameterType
fmtany
...any

Returns WaxLogEntry?

log:debug(fmt, ...)

Logs at debug level.

log:debug(fmt: any, ...: any): WaxLogEntry?
ParameterType
fmtany
...any

Returns WaxLogEntry?

log:info(fmt, ...)

Logs at info level.

log:info(fmt: any, ...: any): WaxLogEntry?
ParameterType
fmtany
...any

Returns WaxLogEntry?

log:warn(fmt, ...)

Logs a warning.

log:warn(fmt: any, ...: any): WaxLogEntry?
ParameterType
fmtany
...any

Returns WaxLogEntry?

log:error(fmt, ...)

Logs an error, which also shows as a notification in the game.

log:error(fmt: any, ...: any): WaxLogEntry?
ParameterType
fmtany
...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
ParameterTypeDescription
namestringLetters, 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)
ParameterTypeDescription
namestringLetters, digits, _ and - only.
valuetable

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)
ParameterType
...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
ParameterType
keystring
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
ParameterType
namestring

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.

FieldTypeDescription
name (optional)stringDisplay name. The folder name when omitted.
version (optional)string"0.0.0" when omitted.
main (optional)stringEntry 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.

FieldTypeDescription
idinteger
timeinteger
level"trace" | "debug" | "info" | "warn" | "error"
channelstring
messagestring
countintegerHow 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.

FunctionNote
LoopAsyncBlocked in Wax mods: it runs Lua on another thread, which corrupts the game's Lua state. Use task.spawn or task.delay.
ExecuteAsyncBlocked in Wax mods: it runs Lua on another thread, which corrupts the game's Lua state. Use task.spawn or task.delay.
ExecuteWithDelayBlocked in Wax mods: it runs Lua on another thread, which corrupts the game's Lua state. Use task.spawn or task.delay.
RegisterKeyBindBlocked in Wax mods: it runs Lua on another thread, which corrupts the game's Lua state. Use ui.Hotkey.
RegisterKeyBindAsyncBlocked in Wax mods: it runs Lua on another thread, which corrupts the game's Lua state. Use ui.Hotkey.
RestartModBlocked in Wax mods: restarting a UE4SS mod destroys the Lua state Wax runs in. Reload the mod through Wax instead.
RestartCurrentModBlocked in Wax mods: restarting a UE4SS mod destroys the Lua state Wax runs in. Reload the mod through Wax instead.
UninstallModBlocked in Wax mods: it destroys the Lua state Wax runs in.
UninstallCurrentModBlocked in Wax mods: it destroys the Lua state Wax runs in.
ClearAllDelayedActionsBlocked in Wax mods: it cancels every mod's timers, and Wax's own frame loop with them.

On this page