Skip to content

Other APIs

Files, JSON, networking, settings, screenshots, and everything else.

Globals

Name Type Description
Enum ENUM_LIST

Enum

Class

Methods

Method Description
GetEnumItems

GetEnumItems

GetEnumItems() -> { any }

Returns: { any }

EnumItem

Class

Properties

Property Type Description
Name string
Value number
EnumType Enum

Methods

Method Description
IsA

IsA

IsA(enumName: string) -> boolean

Parameters

Name Type
enumName string

Returns: boolean

EnumTextJustify_INTERNAL

Class · inherits from Enum

Properties

Property Type Description
Left TextJustify
Center TextJustify
Right TextJustify
InvariantLeft TextJustify
InvariantRight TextJustify
ETextJustify_MAX TextJustify

SpectatorEmote

Class · inherits from EnumItem

EnumSpectatorEmote_INTERNAL

Class · inherits from Enum

Properties

Property Type Description
None SpectatorEmote
Affirmative SpectatorEmote
Negative SpectatorEmote
Left SpectatorEmote
Right SpectatorEmote
Up SpectatorEmote
Down SpectatorEmote
Wave SpectatorEmote
XX SpectatorEmote
Wink SpectatorEmote
Suspicious SpectatorEmote
ESpectatorEmote_MAX SpectatorEmote

LuauFile

Class

File I/O for camera scripts, scoped to the calling script's package folder.

Static functions

Method Description
saveText Writes a UTF-8 text file inside the calling script's package folder.
saveBytes Writes an array of bytes (each in [0, 255]) to a file.
loadTexture Loads and decodes an image file.
loadText Reads a UTF-8 text file from within the calling script's package folder.
loadBytes Reads a binary file and returns its bytes as a 1-indexed table of values in [0, 255].
listFiles Lists all files inside the calling script's package folder recursively. Pass "" to list the whole package, or a relative subfolder to list just that folder.

saveText

LuauFile.saveText(Path: string, Contents: string) -> boolean

Writes a UTF-8 text file inside the calling script's package folder.

Parameters

Name Type
Path string
Contents string

Returns: boolean


saveBytes

LuauFile.saveBytes(Path: string, Bytes: Array<number>) -> boolean

Writes an array of bytes (each in [0, 255]) to a file.

Parameters

Name Type
Path string
Bytes Array<number>

Returns: boolean


loadTexture

LuauFile.loadTexture(Path: string) -> LuauTexture?

Loads and decodes an image file.

Parameters

Name Type
Path string

Returns: LuauTexture?


loadText

LuauFile.loadText(Path: string) -> string

Reads a UTF-8 text file from within the calling script's package folder.

Parameters

Name Type
Path string

Returns: string


loadBytes

LuauFile.loadBytes(Path: string) -> Array<number>

Reads a binary file and returns its bytes as a 1-indexed table of values in [0, 255].

Parameters

Name Type
Path string

Returns: Array<number>


listFiles

LuauFile.listFiles(Path: string) -> Array<string>

Lists all files inside the calling script's package folder recursively. Pass "" to list the whole package, or a relative subfolder to list just that folder.

Parameters

Name Type
Path string

Returns: Array<string>

LuauJson

Class

JSON parsing and serialization for camera scripts.

Static functions

Method Description
serialize Serializes a table (object or array) to a JSON string. Values may be tables, numbers, strings or booleans; anything else makes the whole serialize fail and return an empty string.
parse Parses a JSON string. Objects and arrays become tables, null becomes nil. Returns nil if the text is not valid JSON.

serialize

LuauJson.serialize(Value: Ref, Pretty: boolean) -> string

Serializes a table (object or array) to a JSON string. Values may be tables, numbers, strings or booleans; anything else makes the whole serialize fail and return an empty string.

Parameters

Name Type Description
Value Ref
Pretty boolean Multi-line indented output instead of condensed.

Returns: string


parse

LuauJson.parse(Text: string) -> Ref

Parses a JSON string. Objects and arrays become tables, null becomes nil. Returns nil if the text is not valid JSON.

Parameters

Name Type
Text string

Returns: Ref

ModuleStateSpectatorLuaApi

Class

Module State Spectator Lua Api

Properties

Property Type Description
transform Transform This actual value is never used, only as a proxy for allowing the getter to work

Methods

Method Description
getTeamScore Gets the current score for the specified team
getTeamRoundsWon Gets the number of round wins for the specified team
getTeamColorsArray Get Team Colors Array
getStringConfigVariable Get String Config Variable
getSlotId Get Slot Id
getNumberConfigVariable Get Number Config Variable
getIsGameRunning Get Is Game Running
getGameTimeComponent Returns an object that contains game time information
getBoolConfigVariable Get Bool Config Variable

getTeamScore

getTeamScore(TeamIndex: number) -> number

Gets the current score for the specified team

Parameters

Name Type Description
TeamIndex number Which team to get the score for. 0-indexed.

Returns: number


getTeamRoundsWon

getTeamRoundsWon(TeamIndex: number) -> number

Gets the number of round wins for the specified team

Parameters

Name Type Description
TeamIndex number Which team to get the score for. 0-indexed.

Returns: number


getTeamColorsArray

getTeamColorsArray() -> Array<TeamColor>

Get Team Colors Array

Returns: Array<TeamColor>


getStringConfigVariable

getStringConfigVariable(VariableName: string) -> string

Get String Config Variable

Parameters

Name Type
VariableName string

Returns: string


getSlotId

getSlotId() -> string

Get Slot Id

Returns: string


getNumberConfigVariable

getNumberConfigVariable(VariableName: string) -> number

Get Number Config Variable

Parameters

Name Type
VariableName string

Returns: number


getIsGameRunning

getIsGameRunning() -> boolean

Get Is Game Running

Returns: boolean


getGameTimeComponent

getGameTimeComponent() -> SpectatorGameTimeComponent?

Returns an object that contains game time information

Returns: SpectatorGameTimeComponent?


getBoolConfigVariable

getBoolConfigVariable(VariableName: string) -> boolean

Get Bool Config Variable

Parameters

Name Type
VariableName string

Returns: boolean

Screenshot

Class

Screenshot

Static functions

Method Description
takeScreenshot Takes a high-res screenshot at a given resolution. Screenshots are saved to Documents/Another-Axiom/A2/Screenshots

takeScreenshot

Screenshot.takeScreenshot(Width: number, Height: number) -> string

Takes a high-res screenshot at a given resolution. Screenshots are saved to Documents/Another-Axiom/A2/Screenshots

Parameters

Name Type Description
Width number Width of the screenshot in pixels
Height number Height of the screenshot in pixels

Returns: string

Settings

Class

Change game settings from within luau

Static functions

Method Description
mutePlayerByName Mute a player by name
getLuauReplayControlAllowed Returns true if the user has enabled the option to control replays from luau

mutePlayerByName

Settings.mutePlayerByName(PlayerName: string, bShouldMute: boolean) -> boolean

Mute a player by name

Parameters

Name Type
PlayerName string
bShouldMute boolean

Returns: boolean


getLuauReplayControlAllowed

Settings.getLuauReplayControlAllowed() -> boolean

Returns true if the user has enabled the option to control replays from luau

Returns: boolean

Network

Class

Utility functions for managing connections to game servers

Static functions

Method Description
getCurrentServer Returns the name of the station we are currently connected to. Returns an empty string if not connected.
disconnectFromServer Disconnects from the current server if connected. Returns true on success, false otherwise.
connectToServer Connect to a game server using the given station name

getCurrentServer

Network.getCurrentServer() -> string

Returns the name of the station we are currently connected to. Returns an empty string if not connected.

Returns: string


disconnectFromServer

Network.disconnectFromServer() -> boolean

Disconnects from the current server if connected. Returns true on success, false otherwise.

Returns: boolean


connectToServer

Network.connectToServer(StationName: string) -> boolean

Connect to a game server using the given station name

Parameters

Name Type
StationName string

Returns: boolean