For the complete documentation index, see llms.txt. This page is also available as Markdown.

⚙️Exports

The server exports are callable server-side only, the client exports client-side only.

Server

GetMatch

exports['var_chess']:GetMatch(tableId)

Returns a safe snapshot of the match at tableId, or nil if the id is invalid.

-- { id, status, seats = { white, black }, turn, bet = { white, black }, winner, reason }
-- seats: a server id (number) | 'AI' | false.  turn: 'w' | 'b' | nil.  status: idle | waiting | playing | over.
local match = exports['var_chess']:GetMatch(1)

GetPlayerMatch

exports['var_chess']:GetPlayerMatch(serverId)

Returns the table a player is seated at, or nil.

-- { tableId, color = 'white' | 'black', status }
local seat = exports['var_chess']:GetPlayerMatch(source)

IsPlayerInGame

exports['var_chess']:IsPlayerInGame(serverId)

Returns true only if the player is seated in a match that is currently playing.

GetActiveMatches

exports['var_chess']:GetActiveMatches()

Returns a list of matches in progress.

StartAIGame

exports['var_chess']:StartAIGame(serverId, tableId, side, level, bet)

Seats the player against the AI and starts the game. side is 'white', 'black' or nil (defaults to white), level is a Config.AI.levels id, bet is sanitized server-side. Returns true on success, false if the table is busy, the AI is disabled or the player cannot afford the wager.

ForceEndMatch

exports['var_chess']:ForceEndMatch(tableId, winnerColor)

Ends an in-progress match. winnerColor is 'white', 'black' or nil for a draw. Settlement (payout / refund) runs as usual. Returns true if a playing match was ended.

Client

IsSeated

exports['var_chess']:IsSeated() returns true if the local player is seated at a board.

IsInGame

exports['var_chess']:IsInGame() returns true if the local player is seated in a match that is playing.

GetCurrentTable

exports['var_chess']:GetCurrentTable() returns the local player's current table id, or nil.

GetColor

exports['var_chess']:GetColor() returns 'white', 'black' or nil.

OpenLobby

exports['var_chess']:OpenLobby(tableId) opens the chess menu for a nearby (spawned) table. Returns false if the table is not in range.

Last updated