sm64ex-coop/docs/lua/globals.md

2.2 KiB

Lua Reference

Globals

Globals are variables that are always exposed to the Lua API.


gMarioStates

The gMarioStates[] table is an array from 0 to (MAX_PLAYERS - 1) that contains a MarioState struct for each possible player.

It is indexed by the local playerIndex, so gMarioStates[0] is always the local player.

🔼


gNetworkPlayers

The gNetworkPlayers[] table is an array from 0 to (MAX_PLAYERS - 1) that contains a NetworkPlayer struct for each possible player.

It is indexed by the local playerIndex, so gNetworkPlayers[0] is always the local player.

🔼


gCharacter

The gCharacter[] table is an array from 0 to (CT_MAX - 1) that contains a Character struct for each possible character.

🔼


gTextures

The gTextures table contains references to textures. Listed in GlobalTextures.

🔼


gObjectAnimations

The gObjectAnimations table contains references to object animations. Listed in GlobalObjectAnimations.

🔼


gGlobalSyncTable

The gGlobalSyncTable is a table used for networking. Any field set inside of this table is automatically synchronized with all other clients. Do not use this table for player-specific variables, keep those in gPlayerSyncTable. Player-specific variable will desynchronize within this table since it doesn't automatically translate playerIndex.

🔼


gPlayerSyncTable

The gPlayerSyncTable[] is an array from 0 to (MAX_PLAYERS - 1) that is used for networking. Any field set inside of this table is automatically synchronized with all other clients.

It is indexed by the local playerIndex, so gPlayerSyncTable[0] is always for the local player.

The underlying networking system will automatically translate the local playerIndex so that the field is set for the correct player.

🔼