RE:CORD
REC_Economy

Exports

Welcome to REC_Economy documentation.
Added
Updated

These let your own scripts read the same figures the panel shows — a payday script that checks the money supply first, a Discord bot, a dashboard of your own.

Server side

Anything that reads a total returns nil until the first pass has finished, so check isReady — or just check what came back — before using it.

isReady

Tells you whether the figures are ready yet.

Takes no arguments. Returns boolean.

exports.REC_Economy:isReady()

getStatus

Tells you what it is still waiting for.

Takes no arguments. Returns Status:

FieldTypeDescription
readyboolean
reasonstring?waiting_item_manager / waiting_framework / starting
resourcestring?The resource being waited on
resourceStatestring?What state that resource is in
exports.REC_Economy:getStatus()

getMoneys

Gives you the total of each currency.

Takes no arguments. Returns table<MoneyTypes, MetaData>?:

FieldTypeDescription
keyMoneyTypescash / bank_money / black_money / crypto
valueintegerTotal of that currency
exports.REC_Economy:getMoneys()
sample.lua
RegisterCommand("supply", function()
    if exports.REC_Economy:isReady() == false then
        return
    end

    for moneyType, meta in pairs(exports.REC_Economy:getMoneys()) do
        print(("%s: %d"):format(moneyType, meta.value))
    end
end, true)

getSocieties

Gives you every group account.

Takes no arguments. Returns table<string, SocietyMetaData>?:

FieldTypeDescription
namestringSociety name
labelstringDisplay label
typestring?Society type, if your bank provides one
moneyintegerBalance
exports.REC_Economy:getSocieties()

getSnapshot

Gives you everything the dashboard opens with, in one call.

Takes no arguments. Returns Snapshot?:

FieldTypeDescription
moneystable<MoneyTypes, MetaData>Same as getMoneys
societiestable<string, SocietyMetaData>Same as getSocieties
updatedAtintegerLast full rebuild
sampledAtintegerLast quick re-check
onlineCountintegerCharacters online
characterCountintegerCharacters the total is spread across
targetDaysinteger0 when everybody is counted
bankSupportedbooleanfalse if no banking resource was found
dormancyDormancy?nil until the first scan finishes
exports.REC_Economy:getSnapshot()

getDistribution

Gives you how evenly money is spread across your players.

Takes no arguments. Returns Distribution?:

FieldTypeDescription
countintegerCharacters included
totalintegerMoney they hold
mean / mediannumber
p90 / p99number
gininumber0 is perfectly even, 1 is one person holding everything
top1 / top10numberShare held by the richest 1% and 10%
bucketsBucket[]from, to (nil on the top band) and count
lorenznumber[][]Points for the Lorenz curve
exports.REC_Economy:getDistribution()

getHistory

Gives you the saved totals, oldest first.

ArgumentTypeDescription
daysinteger?How far back to go. 30 by default

Returns HistoryRow[]:

FieldTypeDescription
moneystable<MoneyTypes, integer>Totals at that moment
societyTotalinteger
onlineCountinteger
characterCountinteger0 on rows saved before this was recorded
takenAtinteger
exports.REC_Economy:getHistory(days)

getLastSnapshotAt

Tells you when the last snapshot was saved.

Takes no arguments. Returns integer?.

exports.REC_Economy:getLastSnapshotAt()

refresh

Rebuilds everything now.

Takes no arguments. Returns boolean — false if a rebuild is already running.

exports.REC_Economy:refresh()

getPlayers

Gives you character balances, filtered before they reach you.

ArgumentTypeDescription
searchstring?Matched against citizenId and name
limitinteger?Capped at playerList.limit

Returns PlayersResult? — players (citizenId, name, online, moneys, total) plus matched, total, truncated and targetDays.

exports.REC_Economy:getPlayers(search, limit)

getPlayerMoneys

Gives you one character's balances, whether they are online or not.

ArgumentTypeDescription
citizenIdstring

Returns table<MoneyTypes, integer>?, and their name as a second value.

exports.REC_Economy:getPlayerMoneys(citizenId)

getFlows

Gives you what created and destroyed money, by reason and by job.

ArgumentTypeDescription
daysinteger?How far back to go. 7 by default

Returns Flows?:

FieldTypeDescription
reasonsReason[]reason, added, removed, net, events, and the previous period
jobsJob[]job, added, removed, net, events, avgOnline, periods
seriesPoint[]takenAt, added, removed
added / removedintegerTotals for the period
previousAdded / previousRemovedintegerThe period before this one
pendingAdded / pendingRemovedintegerCounted but not yet saved
supportedbooleanYour framework reports payments
unlabeledEventsintegerPayments with no reason given
totalEventsintegerEvery payment in the period
exports.REC_Economy:getFlows(days)

getRecentFlows

Gives you money movements since you last asked, oldest first.

ArgumentTypeDescription
sinceinteger?The cursor from your last call. 0 or nil starts at the newest

Returns FlowPush? — the next cursor, the events, how many dropped off the end, and the not-yet-saved totals.

exports.REC_Economy:getRecentFlows(since)

getAlerts

Gives you what tripped, newest first.

ArgumentTypeDescription
daysinteger?How far back to go. 7 by default

Returns Alert[]:

FieldTypeDescription
kindAlertKindsupply / player / society / anomaly
subjectstringThe citizenId, or total for the whole server
labelstring?Player name, nil if it could not be read
beforeAmount / afterAmount / deltainteger
sigmanumber?How far past normal, on anomaly alerts only
detectedAtinteger?
exports.REC_Economy:getAlerts(days)

getSocietyHistory

Gives you one group's balance over time, oldest first.

ArgumentTypeDescription
namestringSociety name
daysinteger?How far back to go. 30 by default

Returns a list of { money, takenAt }.

exports.REC_Economy:getSocietyHistory(name, days)

getWatchlist

Gives you who is currently being recorded.

Takes no arguments. Returns WatchEntry[]? — citizenId, label, note, addedBy, expiresAt, createdAt, expired.

exports.REC_Economy:getWatchlist()

addWatch

Starts recording everything one character does with money.

ArgumentTypeDescription
citizenIdstring
notestring?Why you are watching them
addedBystring?Who added them
daysinteger?How long to record for. Falls back to watchlist.defaultDays

Returns boolean, plus an error message when it failed.

exports.REC_Economy:addWatch(citizenId, note, addedBy, days)

removeWatch

Stops recording one character.

ArgumentTypeDescription
citizenIdstring

Returns boolean.

exports.REC_Economy:removeWatch(citizenId)

getWatchEvents

Gives you everything one watched character did, newest first.

ArgumentTypeDescription
citizenIdstring
daysinteger?How far back to go. 7 by default

Returns WatchEvent[] — reason, moneyType, amount, isRemove, at.

exports.REC_Economy:getWatchEvents(citizenId, days)

getNotes

Gives you the notes marked on the charts, oldest first.

ArgumentTypeDescription
daysinteger?How far back to go. 30 by default

Returns Note[] — id, text, author, at.

exports.REC_Economy:getNotes(days)

addNote

Marks a note on the charts.

ArgumentTypeDescription
textstringCut off at 255 characters
authorstring?Who wrote it

Returns boolean.

exports.REC_Economy:addNote(text, author)

deleteNote

Removes one note.

ArgumentTypeDescription
idinteger

Returns boolean.

exports.REC_Economy:deleteNote(id)
getMoneys, getSocieties, getSnapshot and getDistribution answer instantly, so call them freely. Anything taking a days argument goes to the database, so keep those out of loops.

beginActivity

Start an activity with an ID unique within the calling resource and its participants. Staff and duplicate participants are rejected.

ArgumentsReturns
id: string, activity: string, citizenIds: string[]boolean

recordActivityMoney

Add non-negative earned/spent amounts to an active session.

ArgumentsReturns
id: string, earned: number, spent: numberboolean

endActivity

Finish an activity and store its outcome, participant-time and money totals.

ArgumentsReturns
id: string, success: booleanboolean

recordPurchase

Record a positive quantity and non-negative total payment. paid is the total, not the unit price.

ArgumentsReturns
item: string, quantity: number, paid: number, moneyType: stringboolean

getAnalysis

Return analysis for a period (default 7 days, range 1–30) and Unix timestamp anchor. Returns nil before initialization.

ArgumentsReturns
days?: number, anchor?: numbertable|nil
©2026 RE:CORD Development Group. All rights reserved.