Currency¶
Currency helpers for formatting in-game money values and spawning physical money entities.
Overview
The currency library centralizes how Lilia formats money text and keeps the configured singular name, plural name, and symbol in sync with framework config updates. On the server it also provides the helper used to spawn
lia_money entities in the world.
lia.currency.get(amount) View Source
Purpose
Formats a numeric amount into the active in-game currency string.
Realm
Shared
Parameters
number amount The amount of money to format.
Returns
string The formatted currency string using the configured symbol and singular or plural name.
Example Usage
client:notifyInfo(lia.currency.get(250))
print(lia.currency.get(1))
lia.currency.spawn(pos, amount, angle) View Source
Purpose
Spawns a physical lia_money entity at the given position.
Realm
Server
Parameters
Vector pos The world position where the money entity should be created.
number amount The money amount stored on the spawned entity. Negative values are rejected.
Angle angle optional Optional spawn angle for the money entity. Defaults to angle_zero.
Returns
Entity|nil The spawned lia_money entity, or nil when the input is invalid.
Example Usage
local money = lia.currency.spawn(client:getItemDropPos(), 100)
if IsValid(money) then
money.client = client
end