ISteamUser
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
- User.AdvertiseGame(steamIDGameServer, unIPServer, usPortServer)
🤖 Auto-generated binding
- Parameters:
steamIDGameServer (uint64 - CSteamID) –
unIPServer (int) –
usPortServer (int) –
- SteamWorks:
- User.BIsBehindNAT()
🤖 Auto-generated binding
- Returns:
(bool) Return value
- SteamWorks:
- User.BIsPhoneIdentifying()
🤖 Auto-generated binding
- Returns:
(bool) Return value
- SteamWorks:
- User.BIsPhoneRequiringVerification()
🤖 Auto-generated binding
- Returns:
(bool) Return value
- SteamWorks:
- User.BIsPhoneVerified()
🤖 Auto-generated binding
- Returns:
(bool) Return value
- SteamWorks:
- User.BIsTwoFactorEnabled()
🤖 Auto-generated binding
- Returns:
(bool) Return value
- SteamWorks:
Example:
if Steam.User.BIsTwoFactorEnabled() then
print('Steam Guard Mobile Authenticator is enabled')
end
Example:
if not Steam.User.BLoggedOn() then
print('User is not logged in to Steam')
end
- User.BSetDurationControlOnlineState(eNewState)
🤖 Auto-generated binding
- Parameters:
eNewState (int - EDurationControlOnlineState) –
- Returns:
(bool) Return value
- SteamWorks:
- User.BeginAuthSession(pAuthTicket, cbAuthTicket, steamID)
🤖 Auto-generated binding
- Parameters:
pAuthTicket (str?) –
cbAuthTicket (int) – size of the input array
pAuthTicketsteamID (uint64 - CSteamID) –
- Returns:
(int - EBeginAuthSessionResult) Return value
- SteamWorks:
Example:
-- Server-side: validate a ticket received from a client
local result = Steam.User.BeginAuthSession(authTicketData, #authTicketData, clientSteamID)
if result ~= Steam.k_EBeginAuthSessionResultOK then
print('Auth session failed to start:', result)
end
- User.CancelAuthTicket(hAuthTicket)
🤖 Auto-generated binding
- Parameters:
hAuthTicket (int - HAuthTicket) –
- SteamWorks:
Example:
Steam.User.CancelAuthTicket(ticketHandle)
- User.DecompressVoice(pCompressed, cbCompressed, cbDestBufferSize, nDesiredSampleRate)
🤖 Auto-generated binding
- Parameters:
pCompressed (str?) –
cbCompressed (int) – size of the input array
pCompressedcbDestBufferSize (int?) – size of the buffer to allocate for
pDestBuffer. Ifnilthen the buffer will beNULL.nDesiredSampleRate (int) –
- Returns:
(int - EVoiceResult) Return value
- Returns:
(str)
pDestBuffer- Returns:
(int)
nBytesWritten- SteamWorks:
Signature differences from C++ API:
Parameter
pDestBufferis not a parameter in Lua — it is an output-only pointer in C++ and is returned as an additional return value.Parameter
nBytesWrittenis not a parameter in Lua — it is an output-only pointer in C++ and is returned as an additional return value.
Example:
local SAMPLE_RATE = 24000
local decompressed = Steam.User.DecompressVoice(compressedData, #compressedData, 65536, SAMPLE_RATE)
if decompressed then
playAudio(decompressed, SAMPLE_RATE)
end
- User.EndAuthSession(steamID)
🤖 Auto-generated binding
- Parameters:
steamID (uint64 - CSteamID) –
- SteamWorks:
Example:
-- End auth session when client disconnects
Steam.User.EndAuthSession(clientSteamID)
- User.GetAuthSessionTicket(cbMaxTicket, pSteamNetworkingIdentity)
🤖 Auto-generated binding
- Parameters:
cbMaxTicket (int?) – size of the buffer to allocate for
pTicket. Ifnilthen the buffer will beNULL.pSteamNetworkingIdentity – (SteamNetworkingIdentity)
- Returns:
(int - HAuthTicket) Return value
- Returns:
(str)
pTicket- Returns:
(int)
pcbTicket- SteamWorks:
Signature differences from C++ API:
Parameter
pTicketis not a parameter in Lua — it is an output-only pointer in C++ and is returned as an additional return value.Parameter
pcbTicketis not a parameter in Lua — it is an output-only pointer in C++ and is returned as an additional return value.
Example:
local data = Steam.User.GetAuthSessionTicket('webapi:myservice')
if data then
local ticketHandle = data.m_hAuthTicket
local ticketData = data.hexTicket
-- Send ticketData to your server for verification
end
- User.GetAuthTicketForWebApi(pchIdentity)
🤖 Auto-generated binding
- Parameters:
pchIdentity (str?) –
- Returns:
(int - HAuthTicket) Return value
- SteamWorks:
- User.GetAvailableVoice()
🤖 Auto-generated binding
- Returns:
(int - EVoiceResult) Return value
- Returns:
(int)
pcbCompressed- SteamWorks:
Signature differences from C++ API:
Parameter
pcbCompressedis not a parameter in Lua — it is an output-only pointer in C++ and is returned as an additional return value.
Notes:
See
User.GetVoice()’s example.
- User.GetDurationControl(callback)
🤖 Auto-generated binding
- Parameters:
callback (function) – CallResult callback receiving struct
DurationControl_tand a boolean- Returns:
(uint64)
SteamAPICall_thandle for this async call. The result is delivered via thecallbackparameter whenSteam.RunCallbacks()is called.- SteamWorks:
- User.GetEncryptedAppTicket(cbMaxTicket)
🤖 Auto-generated binding
- Parameters:
cbMaxTicket (int?) – size of the buffer to allocate for
pTicket. Ifnilthen the buffer will beNULL.- Returns:
(bool) Return value
- Returns:
(str)
pTicket- Returns:
(int)
pcbTicket- SteamWorks:
Signature differences from C++ API:
Parameter
pTicketis not a parameter in Lua — it is an output-only pointer in C++ and is returned as an additional return value.Parameter
pcbTicketis not a parameter in Lua — it is an output-only pointer in C++ and is returned as an additional return value.
- User.GetGameBadgeLevel(nSeries, bFoil)
🤖 Auto-generated binding
- Parameters:
nSeries (int) –
bFoil (bool) –
- Returns:
(int) Return value
- SteamWorks:
Example:
local level = Steam.User.GetGameBadgeLevel(1, false)
print('Badge level:', level)
- User.GetHSteamUser()
🤖 Auto-generated binding
- Returns:
(int - HSteamUser) Return value
- SteamWorks:
- User.GetMarketEligibility(callback)
🤖 Auto-generated binding
- Parameters:
callback (function) – CallResult callback receiving struct
MarketEligibilityResponse_tand a boolean- Returns:
(uint64)
SteamAPICall_thandle for this async call. The result is delivered via thecallbackparameter whenSteam.RunCallbacks()is called.- SteamWorks:
- User.GetPlayerSteamLevel()
🤖 Auto-generated binding
- Returns:
(int) Return value
- SteamWorks:
Example:
print('Let me show you some magic')
print('Your Steam Level is...')
print(tostring(Steam.User.GetPlayerSteamLevel()) .. '!!!')
- User.GetSteamID()
🤖 Auto-generated binding
- Returns:
(uint64 - CSteamID) Return value
- SteamWorks:
Returns the CSteamID of the account currently logged in to the Steam client.
Example:
local my_id = Steam.User.GetSteamID()
local function isSteamIDFromUser(steam_id)
return steam_id == my_id
end
- User.GetUserDataFolder(cubBuffer)
🤖 Auto-generated binding
- Parameters:
cubBuffer (int?) – size of the buffer to allocate for
pchBuffer. Ifnilthen the buffer will beNULL.- Returns:
(bool) Return value
- Returns:
(str)
pchBuffer- SteamWorks:
Signature differences from C++ API:
Parameter
pchBufferis not a parameter in Lua — it is an output-only pointer in C++ and is returned as an additional return value.
Example:
local success, path = Steam.User.GetUserDataFolder(512)
if success then
print('User data folder: ' .. path)
end
- User.GetVoice(bWantCompressed, cbDestBufferSize)
🤖 Auto-generated binding
- Parameters:
bWantCompressed (bool) –
cbDestBufferSize (int?) – size of the buffer to allocate for
pDestBuffer. Ifnilthen the buffer will beNULL.
- Returns:
(int - EVoiceResult) Return value
- Returns:
(str)
pDestBuffer- Returns:
(int)
nBytesWritten- SteamWorks:
Signature differences from C++ API:
Parameter
pDestBufferis not a parameter in Lua — it is an output-only pointer in C++ and is returned as an additional return value.Parameter
nBytesWrittenis not a parameter in Lua — it is an output-only pointer in C++ and is returned as an additional return value.
Example:
local _, sizeCompressed = Steam.User.GetAvailableVoice()
if available > 0 then
local ok, voiceData = Steam.User.GetVoice(true, sizeCompressed)
if ok == Steam.k_EVoiceResultOK then
sendVoiceToNetwork(voiceData)
end
end
- User.GetVoiceOptimalSampleRate()
🤖 Auto-generated binding
- Returns:
(int) Return value
- SteamWorks:
Example:
local sampleRate = Steam.User.GetVoiceOptimalSampleRate()
print('Optimal voice sample rate: ' .. sampleRate .. ' Hz')
- User.RequestEncryptedAppTicket(pDataToInclude, cbDataToInclude, callback)
🤖 Auto-generated binding
- Parameters:
pDataToInclude (str?) –
cbDataToInclude (int) – size of the input array
pDataToIncludecallback (function) – CallResult callback receiving struct
EncryptedAppTicketResponse_tand a boolean
- Returns:
(uint64)
SteamAPICall_thandle for this async call. The result is delivered via thecallbackparameter whenSteam.RunCallbacks()is called.- SteamWorks:
Example:
local userData = 'extra_data'
Steam.User.RequestEncryptedAppTicket(userData, #userData, function(data, err)
if err or data.m_eResult ~= Steam.k_EResultOK then
print('Failed to get encrypted app ticket')
end
end)
- User.RequestStoreAuthURL(pchRedirectURL, callback)
🤖 Auto-generated binding
- Parameters:
pchRedirectURL (str?) –
callback (function) – CallResult callback receiving struct
StoreAuthURLResponse_tand a boolean
- Returns:
(uint64)
SteamAPICall_thandle for this async call. The result is delivered via thecallbackparameter whenSteam.RunCallbacks()is called.- SteamWorks:
- User.StartVoiceRecording()
🤖 Auto-generated binding
- SteamWorks:
Example:
-- Call when push-to-talk key is pressed
Steam.User.StartVoiceRecording()
- User.StopVoiceRecording()
🤖 Auto-generated binding
- SteamWorks:
Example:
-- Call when push-to-talk key is released
Steam.User.StopVoiceRecording()
- User.TrackAppUsageEvent(gameID, eAppUsageEvent, pchExtraInfo)
🤖 Auto-generated binding
- Parameters:
gameID (uint64 - CGameID) –
eAppUsageEvent (int) –
pchExtraInfo (str?) –
- SteamWorks:
- User.UserHasLicenseForApp(steamID, appID)
🤖 Auto-generated binding
- Parameters:
steamID (uint64 - CSteamID) –
appID (int - AppId_t) –
- Returns:
(int - EUserHasLicenseForAppResult) Return value
- SteamWorks:
Example:
local status = Steam.User.UserHasLicenseForApp(playerSteamID, dlcAppID)
if status == Steam.k_EUserHasLicenseResultHasLicense then
print('Player owns the DLC')
end
Callbacks
- User.OnSteamServersConnected()
Callback for SteamServersConnected_t
callback(data) receives no fields (notification only).
Example:
function Steam.User.OnSteamServersConnected()
print('Connected to Steam servers')
end
- User.OnSteamServerConnectFailure()
Callback for SteamServerConnectFailure_t
callback(data) receives:
data.m_eResult (int - EResult)
data.m_bStillRetrying (bool)
- User.OnSteamServersDisconnected()
Callback for SteamServersDisconnected_t
callback(data) receives:
data.m_eResult (int - EResult)
Example:
function Steam.User.OnSteamServersDisconnected(data)
print('Disconnected from Steam servers, result:', data.m_eResult)
end
- User.OnClientGameServerDeny()
Callback for ClientGameServerDeny_t
callback(data) receives:
data.m_uAppID (int)
data.m_unGameServerIP (int)
data.m_usGameServerPort (int)
data.m_bSecure (int)
data.m_uReason (int)
- User.OnIPCFailure()
Callback for IPCFailure_t
callback(data) receives:
data.m_eFailureType (int)
- User.OnLicensesUpdated()
Callback for LicensesUpdated_t
callback(data) receives no fields (notification only).
- User.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.User.OnValidateAuthTicketResponse(data)
if data.m_eAuthSessionResponse == Steam.k_EAuthSessionResponseOK then
print('User validated:', tostring(data.m_SteamID))
else
kickPlayer(data.m_SteamID)
end
end
- User.OnMicroTxnAuthorizationResponse()
Callback for MicroTxnAuthorizationResponse_t
callback(data) receives:
data.m_unAppID (int)
data.m_ulOrderID (uint64)
data.m_bAuthorized (int)
Example:
function Steam.User.OnMicroTxnAuthorizationResponse(data)
if data.m_bAuthorized ~= 0 then
print('Purchase authorized, orderID:', tostring(data.m_ulOrderID))
completePurchase(data.m_ulOrderID)
else
print('Purchase cancelled by user')
end
end
- User.OnEncryptedAppTicketResponse()
Callback for EncryptedAppTicketResponse_t
callback(data) receives:
data.m_eResult (int - EResult)
Example:
function Steam.User.OnEncryptedAppTicketResponse(data)
if data.m_eResult == Steam.k_EResultOK then
local ticket = Steam.User.GetEncryptedAppTicket(1024)
sendTicketToServer(ticket)
end
end
- User.OnGetAuthSessionTicketResponse()
Callback for GetAuthSessionTicketResponse_t
callback(data) receives:
data.m_hAuthTicket (int - HAuthTicket)
data.m_eResult (int - EResult)
Example:
function Steam.User.OnGetAuthSessionTicketResponse(data)
if data.m_eResult == Steam.k_EResultOK then
print('Auth ticket ready, handle:', tostring(data.m_hAuthTicket))
else
print('Auth ticket failed:', data.m_eResult)
end
end
- User.OnGameWebCallback()
Callback for GameWebCallback_t
callback(data) receives:
data.m_szURL (string)
- User.OnStoreAuthURLResponse()
Callback for StoreAuthURLResponse_t
callback(data) receives:
data.m_szURL (string)
- User.OnMarketEligibilityResponse()
Callback for MarketEligibilityResponse_t
callback(data) receives:
data.m_bAllowed (bool)
data.m_eNotAllowedReason (int - EMarketNotAllowedReasonFlags)
data.m_rtAllowedAtTime (int - RTime32)
data.m_cdaySteamGuardRequiredDays (int)
data.m_cdayNewDeviceCooldown (int)
- User.OnDurationControl()
Callback for DurationControl_t
callback(data) receives:
data.m_eResult (int - EResult)
data.m_appid (int - AppId_t)
data.m_bApplicable (bool)
data.m_csecsLast5h (int)
data.m_progress (int - EDurationControlProgress)
data.m_notification (int - EDurationControlNotification)
data.m_csecsToday (int)
data.m_csecsRemaining (int)
- User.OnGetTicketForWebApiResponse()
Callback for GetTicketForWebApiResponse_t
callback(data) receives:
data.m_hAuthTicket (int - HAuthTicket)
data.m_eResult (int - EResult)
data.m_cubTicket (int)
data.m_rgubTicket (string)
- User.OnGSPolicyResponse()
Callback for GSPolicyResponse_t
callback(data) receives:
data.m_bSecure (int)