ISteamGameServer

Note

This documentation is auto-generated. Methods marked with 🤖 are automatically generated bindings. Methods marked with ✍️ are manually implemented and methods marked with ✋ are currently not implemented.

List of Functions

List of Callbacks

Function Reference

GameServer.AssociateWithClan(steamIDClan, callback)

🤖 Auto-generated binding

Parameters:
  • steamIDClan (uint64 - CSteamID) –

  • callback (function) – CallResult callback receiving struct AssociateWithClanResult_t and a boolean

Returns:

(uint64) SteamAPICall_t handle for this async call. The result is delivered via the callback parameter when Steam.RunCallbacks() is called.

SteamWorks:

AssociateWithClan

GameServer.BLoggedOn()

🤖 Auto-generated binding

Returns:

(bool) Return value

SteamWorks:

BLoggedOn

Example:

local loggedOn = Steam.GameServer.BLoggedOn()
GameServer.BSecure()

🤖 Auto-generated binding

Returns:

(bool) Return value

SteamWorks:

BSecure

Example:

local secure = Steam.GameServer.BSecure()
if secure then
    print('Server is VAC-secured')
end
GameServer.BUpdateUserData(steamIDUser, pchPlayerName, uScore)

🤖 Auto-generated binding

Parameters:
  • steamIDUser (uint64 - CSteamID) –

  • pchPlayerName (str?) –

  • uScore (int) –

Returns:

(bool) Return value

SteamWorks:

BUpdateUserData

Example:

-- Update a connected player's display name and score
Steam.GameServer.BUpdateUserData(playerSteamID, playerName, playerScore)
GameServer.BeginAuthSession(pAuthTicket, cbAuthTicket, steamID)

🤖 Auto-generated binding

Parameters:
  • pAuthTicket (str?) –

  • cbAuthTicket (int) – size of the input array pAuthTicket

  • steamID (uint64 - CSteamID) –

Returns:

(int - EBeginAuthSessionResult) Return value

SteamWorks:

BeginAuthSession

Example:

-- Validate an auth ticket received from a client
local result = Steam.GameServer.BeginAuthSession(authTicket, authTicketSize, clientSteamID)
if result == k_EBeginAuthSessionResultOK then
    print('Started auth session for', clientSteamID)
else
    print('Failed to start auth session', result)
end
GameServer.CancelAuthTicket(hAuthTicket)

🤖 Auto-generated binding

Parameters:

hAuthTicket (int - HAuthTicket) –

SteamWorks:

CancelAuthTicket

GameServer.ClearAllKeyValues()

🤖 Auto-generated binding

SteamWorks:

ClearAllKeyValues

Example:

Steam.GameServer.ClearAllKeyValues()
-- Reset and re-add updated values
Steam.GameServer.SetKeyValue('version', '1.6.0')
GameServer.ComputeNewPlayerCompatibility(steamIDNewPlayer, callback)

🤖 Auto-generated binding

Parameters:
Returns:

(uint64) SteamAPICall_t handle for this async call. The result is delivered via the callback parameter when Steam.RunCallbacks() is called.

SteamWorks:

ComputeNewPlayerCompatibility

GameServer.CreateUnauthenticatedUserConnection()

🤖 Auto-generated binding

Returns:

(uint64 - CSteamID) Return value

SteamWorks:

CreateUnauthenticatedUserConnection

GameServer.EndAuthSession(steamID)

🤖 Auto-generated binding

Parameters:

steamID (uint64 - CSteamID) –

SteamWorks:

EndAuthSession

Example:

Steam.GameServer.EndAuthSession(steamID)
GameServer.GetAuthSessionTicket(cbMaxTicket, pSnid)

🤖 Auto-generated binding

Parameters:
  • cbMaxTicket (int?) – size of the buffer to allocate for pTicket. If nil then the buffer will be NULL.

  • pSnid – (SteamNetworkingIdentity)

Returns:

(int - HAuthTicket) Return value

Returns:

(str) pTicket

Returns:

(int) pcbTicket

SteamWorks:

GetAuthSessionTicket

Signature differences from C++ API:

  • Parameter pTicket is not a parameter in Lua — it is an output-only pointer in C++ and is returned as an additional return value.

  • Parameter pcbTicket is not a parameter in Lua — it is an output-only pointer in C++ and is returned as an additional return value.

GameServer.GetGameplayStats()

🤖 Auto-generated binding

SteamWorks:

GetGameplayStats

GameServer.GetNextOutgoingPacket(cbMaxOut)

🤖 Auto-generated binding

Parameters:

cbMaxOut (int?) – size of the buffer to allocate for pOut. If nil then the buffer will be NULL.

Returns:

(int) Return value

Returns:

(str) pOut

Returns:

(int) pNetAdr

Returns:

(int) pPort

SteamWorks:

GetNextOutgoingPacket

Signature differences from C++ API:

  • Parameter pOut is not a parameter in Lua — it is an output-only pointer in C++ and is returned as an additional return value.

  • Parameter pNetAdr is not a parameter in Lua — it is an output-only pointer in C++ and is returned as an additional return value.

  • Parameter pPort is not a parameter in Lua — it is an output-only pointer in C++ and is returned as an additional return value.

GameServer.GetPublicIP()

🤖 Auto-generated binding

Returns:

(SteamIPAddress_t) Return value

SteamWorks:

GetPublicIP

Example:

local ip = Steam.GameServer.GetPublicIP()
print('Server public IP:', ip.m_rgubIPv6)
GameServer.GetServerReputation(callback)

🤖 Auto-generated binding

Parameters:

callback (function) – CallResult callback receiving struct GSReputation_t and a boolean

Returns:

(uint64) SteamAPICall_t handle for this async call. The result is delivered via the callback parameter when Steam.RunCallbacks() is called.

SteamWorks:

GetServerReputation

GameServer.GetSteamID()

🤖 Auto-generated binding

Returns:

(uint64 - CSteamID) Return value

SteamWorks:

GetSteamID

Example:

local server_id = Steam.GameServer.GetSteamID()
print('Server Steam ID:', tostring(server_id))
GameServer.HandleIncomingPacket(pData, cbData, srcIP, srcPort)

🤖 Auto-generated binding

Parameters:
  • pData (str?) –

  • cbData (int) – size of the input array pData

  • srcIP (int) –

  • srcPort (int) –

Returns:

(bool) Return value

SteamWorks:

HandleIncomingPacket

GameServer.LogOff()

🤖 Auto-generated binding

SteamWorks:

LogOff

Example:

Steam.GameServer.LogOff()
GameServer.LogOn(pszToken)

🤖 Auto-generated binding

Parameters:

pszToken (str?) –

SteamWorks:

LogOn

Example:

local accessToken = 'abcdef123456'  -- Access token from Steam partner site
Steam.GameServer.LogOn(accessToken)
GameServer.LogOnAnonymous()

🤖 Auto-generated binding

SteamWorks:

LogOnAnonymous

Example:

Steam.GameServer.LogOnAnonymous()
GameServer.RequestUserGroupStatus(steamIDUser, steamIDGroup)

🤖 Auto-generated binding

Parameters:
  • steamIDUser (uint64 - CSteamID) –

  • steamIDGroup (uint64 - CSteamID) –

Returns:

(bool) Return value

SteamWorks:

RequestUserGroupStatus

Example:

-- Check if a player is in a Steam group (e.g. for whitelist)
Steam.GameServer.RequestUserGroupStatus(playerSteamID, groupSteamID)
GameServer.SetAdvertiseServerActive(bActive)

🤖 Auto-generated binding

Parameters:

bActive (bool) –

SteamWorks:

SetAdvertiseServerActive

Example:

-- Make the server visible in the server browser
Steam.GameServer.SetAdvertiseServerActive(true)
GameServer.SetBotPlayerCount(cBotplayers)

🤖 Auto-generated binding

Parameters:

cBotplayers (int) –

SteamWorks:

SetBotPlayerCount

Example:

Steam.GameServer.SetBotPlayerCount(0)
GameServer.SetDedicatedServer(bDedicated)

🤖 Auto-generated binding

Parameters:

bDedicated (bool) –

SteamWorks:

SetDedicatedServer

Example:

Steam.GameServer.SetDedicatedServer(true)
GameServer.SetGameData(pchGameData)

🤖 Auto-generated binding

Parameters:

pchGameData (str?) –

SteamWorks:

SetGameData

GameServer.SetGameDescription(pszGameDescription)

🤖 Auto-generated binding

Parameters:

pszGameDescription (str?) –

SteamWorks:

SetGameDescription

Example:

Steam.GameServer.SetGameDescription('A competitive FPS game')
GameServer.SetGameTags(pchGameTags)

🤖 Auto-generated binding

Parameters:

pchGameTags (str?) –

SteamWorks:

SetGameTags

Example:

Steam.GameServer.SetGameTags('ranked,competitive')
GameServer.SetKeyValue(pKey, pValue)

🤖 Auto-generated binding

Parameters:
  • pKey (str?) –

  • pValue (str?) –

SteamWorks:

SetKeyValue

Example:

-- Set server rules visible in the server browser
Steam.GameServer.SetKeyValue('version', '1.5.0')
Steam.GameServer.SetKeyValue('region', 'us-east')
GameServer.SetMapName(pszMapName)

🤖 Auto-generated binding

Parameters:

pszMapName (str?) –

SteamWorks:

SetMapName

Example:

Steam.GameServer.SetMapName('de_dust2')
GameServer.SetMaxPlayerCount(cPlayersMax)

🤖 Auto-generated binding

Parameters:

cPlayersMax (int) –

SteamWorks:

SetMaxPlayerCount

Example:

Steam.GameServer.SetMaxPlayerCount(16)
GameServer.SetModDir(pszModDir)

🤖 Auto-generated binding

Parameters:

pszModDir (str?) –

SteamWorks:

SetModDir

GameServer.SetPasswordProtected(bPasswordProtected)

🤖 Auto-generated binding

Parameters:

bPasswordProtected (bool) –

SteamWorks:

SetPasswordProtected

Example:

Steam.GameServer.SetPasswordProtected(false)
GameServer.SetProduct(pszProduct)

🤖 Auto-generated binding

Parameters:

pszProduct (str?) –

SteamWorks:

SetProduct

GameServer.SetRegion(pszRegion)

🤖 Auto-generated binding

Parameters:

pszRegion (str?) –

SteamWorks:

SetRegion

GameServer.SetServerName(pszServerName)

🤖 Auto-generated binding

Parameters:

pszServerName (str?) –

SteamWorks:

SetServerName

Example:

Steam.GameServer.SetServerName('My Awesome Server')
GameServer.SetSpectatorPort(unSpectatorPort)

🤖 Auto-generated binding

Parameters:

unSpectatorPort (int) –

SteamWorks:

SetSpectatorPort

GameServer.SetSpectatorServerName(pszSpectatorServerName)

🤖 Auto-generated binding

Parameters:

pszSpectatorServerName (str?) –

SteamWorks:

SetSpectatorServerName

GameServer.UserHasLicenseForApp(steamID, appID)

🤖 Auto-generated binding

Parameters:
  • steamID (uint64 - CSteamID) –

  • appID (int - AppId_t) –

Returns:

(int - EUserHasLicenseForAppResult) Return value

SteamWorks:

UserHasLicenseForApp

GameServer.WasRestartRequested()

🤖 Auto-generated binding

Returns:

(bool) Return value

SteamWorks:

WasRestartRequested

Example:

if Steam.GameServer.WasRestartRequested() then
    print('Steam requested server restart for update')
    scheduleRestart()
end

Callbacks

GameServer.OnSteamServersConnected()

Callback for SteamServersConnected_t

callback(data) receives no fields (notification only).

Example:

function Steam.GameServer.OnSteamServersConnected()
    print('Connected to Steam servers')
end
GameServer.OnSteamServerConnectFailure()

Callback for SteamServerConnectFailure_t

callback(data) receives:

  • data.m_eResult (int - EResult)

  • data.m_bStillRetrying (bool)

Example:

function Steam.GameServer.OnSteamServerConnectFailure(data)
    print('Connection to Steam failed:', data.m_eResult, 'retrying:', data.m_bStillRetrying)
end
GameServer.OnSteamServersDisconnected()

Callback for SteamServersDisconnected_t

callback(data) receives:

  • data.m_eResult (int - EResult)

Example:

function Steam.GameServer.OnSteamServersDisconnected(data)
    print('Disconnected from Steam servers:', data.m_eResult)
end
GameServer.OnValidateAuthTicketResponse()

Callback for ValidateAuthTicketResponse_t

callback(data) receives:

  • data.m_SteamID (uint64 - CSteamID)

  • data.m_eAuthSessionResponse (int - EAuthSessionResponse)

  • data.m_OwnerSteamID (uint64 - CSteamID)

Example:

function Steam.GameServer.OnValidateAuthTicketResponse(data)
    if data.m_eAuthSessionResponse == Steam.k_EAuthSessionResponseOK then
        print('User authenticated:', tostring(data.m_SteamID))
    else
        print('Authentication failed:', data.m_eAuthSessionResponse)
    end
end
GameServer.OnGSClientApprove()

Callback for GSClientApprove_t

callback(data) receives:

  • data.m_SteamID (uint64 - CSteamID)

  • data.m_OwnerSteamID (uint64 - CSteamID)

Example:

function Steam.GameServer.OnGSClientApprove(data)
    print('Client approved:', tostring(data.m_SteamID))
    allowPlayerToJoin(data.m_SteamID)
end
GameServer.OnGSClientDeny()

Callback for GSClientDeny_t

callback(data) receives:

  • data.m_SteamID (uint64 - CSteamID)

  • data.m_eDenyReason (int - EDenyReason)

  • data.m_rgchOptionalText (string)

Example:

function Steam.GameServer.OnGSClientDeny(data)
    print('Client denied:', tostring(data.m_SteamID), 'reason:', data.m_eDenyReason)
    kickPlayer(data.m_SteamID)
end
GameServer.OnGSClientKick()

Callback for GSClientKick_t

callback(data) receives:

  • data.m_SteamID (uint64 - CSteamID)

  • data.m_eDenyReason (int - EDenyReason)

GameServer.OnGSClientAchievementStatus()

Callback for GSClientAchievementStatus_t

callback(data) receives:

  • data.m_SteamID (uint64)

  • data.m_pchAchievement (string)

  • data.m_bUnlocked (bool)

GameServer.OnGSPolicyResponse()

Callback for GSPolicyResponse_t

callback(data) receives:

  • data.m_bSecure (int)

Example:

function Steam.GameServer.OnGSPolicyResponse(data)
    if Steam.GameServer.BSecure() then
        print('Server is VAC secured')
    end
end
GameServer.OnGSGameplayStats()

Callback for GSGameplayStats_t

callback(data) receives:

  • data.m_eResult (int - EResult)

  • data.m_nRank (int)

  • data.m_unTotalConnects (int)

  • data.m_unTotalMinutesPlayed (int)

GameServer.OnGSClientGroupStatus()

Callback for GSClientGroupStatus_t

callback(data) receives:

  • data.m_SteamIDUser (uint64 - CSteamID)

  • data.m_SteamIDGroup (uint64 - CSteamID)

  • data.m_bMember (bool)

  • data.m_bOfficer (bool)

Example:

function Steam.GameServer.OnGSClientGroupStatus(data)
    if data.m_bMember then
        print('Player is a member of the required group:', tostring(data.m_SteamIDUser))
    end
end
GameServer.OnGSReputation()

Callback for GSReputation_t

callback(data) receives:

  • data.m_eResult (int - EResult)

  • data.m_unReputationScore (int)

  • data.m_bBanned (bool)

  • data.m_unBannedIP (int)

  • data.m_usBannedPort (int)

  • data.m_ulBannedGameID (uint64)

  • data.m_unBanExpires (int)

GameServer.OnAssociateWithClanResult()

Callback for AssociateWithClanResult_t

callback(data) receives:

  • data.m_eResult (int - EResult)

GameServer.OnComputeNewPlayerCompatibilityResult()

Callback for ComputeNewPlayerCompatibilityResult_t

callback(data) receives:

  • data.m_eResult (int - EResult)

  • data.m_cPlayersThatDontLikeCandidate (int)

  • data.m_cPlayersThatCandidateDoesntLike (int)

  • data.m_cClanPlayersThatDontLikeCandidate (int)

  • data.m_SteamIDCandidate (uint64 - CSteamID)