-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
Use a local PleasureLib runtime for each consuming mod. The runtime keeps mod-specific state such as the log prefix, debug flag, and object cache scoped to that mod.
Place pleasure_lib_loader.lua next to the consuming mod's main.lua. Copy the
implementation from Recommended Loader.
Example layout:
Mods/MyMod/
enabled.txt
Scripts/
main.lua
pleasure_lib_loader.lua
At the top of the consuming mod's main.lua:
local pleasureLib = require("pleasure_lib_loader").new("MyMod")
if type(pleasureLib) ~= "table" then return endThe string passed to new becomes the log prefix:
[MyMod] loaded
Enable debug logging when needed:
local pleasureLib = require("pleasure_lib_loader").new("MyMod", {
debug = true,
})pleasureLib:log("loaded")
local content = pleasureLib:read_text_file(config_path)
local config = pleasureLib:parse_ini(content)
local npc = pleasureLib:find_object("/Game/Some/Object.Path")
if pleasureLib:is_valid(npc) then
pleasureLib:debug_log(pleasureLib:full_name(npc))
endRegister a hook without exposing the mod to an unprotected UE4SS call:
pleasureLib:register_hook(
"/Script/Engine.PlayerController:ClientRestart",
function()
pleasureLib:log("ClientRestart fired")
end
)- API Core Utilities covers construction, logging, errors, strings, config, arrays, and files.
- API Unreal and Runtime covers Unreal objects, lookup, capture, delays, and hooks.
- Native Game Settings covers localized ON/OFF rows in the game's settings UI.
For normal mod code, prefer the local runtime shown above. PleasureLib also
exposes several stateless helpers directly on _G.PleasureLib for compatibility
and simple utility use. They are listed under Static exports.
PleasureLib is idempotent. Loading the same version again returns the existing
_G.PleasureLib table. Each call to PleasureLib.new(...) still creates a fresh
runtime with its own log prefix, debug flag, and object cache.