characters.
Balances belong to the loaded character. Every change writes a ledger row in the same transaction. Accounts are defined in config/accounts.lua:
config/accounts.lua
Server
GetBalance / GetAll
nil when no character is loaded.
Add / Remove / Set
integer
required
Positive.
string
Stored in the ledger.
integer?
The new balance.
UgErrorCode?
not_loaded without a character, insufficient_funds unless the account allows negative balances, no_permission when a hook cancelled.Set records the difference in the ledger. Add and Remove run the Accounts:BeforeAdd and Accounts:BeforeRemove hooks.
Transfer
balance is the sender’s. Runs Accounts:BeforeTransfer.
GetLedger
integer
default:"25"
1 to 100.
UgLedgerEntry[]
Newest first.
Client
Example
ug-core:Accounts:Changed with (source, account, balance, delta, reason) to update a HUD.