ISteamUser

List of Functions

List of Callbacks

Function Reference

user.getPlayerSteamLevel()
Returns:

(number) The level of the current user.

SteamWorks:

GetPlayerSteamLevel

Gets the Steam level of the user, as shown on their Steam community profile.

Example:

print('Let me show you some magic')
print('Your Steam Level is...')
print(Steam.user.getPlayerSteamLevel() .. '!!!')
user.getSteamID()
Returns:

(uint64) The SteamID of the current user.

SteamWorks:

GetSteamID

Gets the Steam ID of the account currently logged into the Steam client. This is commonly called the ‘current user’, or ‘local user’.

A Steam ID is a unique identifier for a Steam accounts, Steam groups, Lobbies and Chat rooms, and used to differentiate users in all parts of the Steamworks API.

Example:

local my_id = Steam.user.getSteamID()
function isSteamIDFromUser(steam_id)
    return steam_id == my_id
end
user.getAuthSessionTicket(identityRemote)
Parameters:

identityRemote (string) – String representing the remote system that will authenticate the ticket.

Returns:

(data) A result table if successful, otherwise nil

  • data.ticket (number) The handle for the auth session ticket (only has meaning on the client on where you called this, is NOT an auth ticket)

  • data.hexTicket (string) The ticket data as a hexadeximal formatted string. This is the ticket that you need to send to the server/authenticating instance.

SteamWorks:

GetAuthSessionTicket

Retrieve an authentication ticket from steam. You can use this to authenticate yourself with a third party server. You should wait for a successful callback to user.onAuthSessionTicketResponse() (indicating that Steam has accepted your request for a ticket) before using this ticket.

The ticket size is fixed at 1024 characters. If your game has too much DLC, it might need more, which would need a change in luasteam as it’s not customisable right now.

When you’re done with the ticket you must call user.cancelAuthTicket() on the handle.

Example:

local data = Steam.user.getAuthSessionTicket() -- keep the ticket handle around
if data then
   local ticketHandle = data.ticket
   local ticketData = data.hexTicket
   -- Now do something with it
end
user.cancelAuthTicket()
Parameters:

ticketHandle (number) – The ticket handle to cancel the auth ticket for. You need to call this once you are done using a requested or scheduled ticket. Make sure to call this for any open ticket handles when quitting your application.

Returns:

nothing

SteamWorks:

CancelAuthTicket

Example:

Steam.user.cancelAuthTicket(ticketHandle)

Callbacks Reference

Warning

Remember callbacks are functions that you should override in order to receive the events, and not call directly.

Also, you must constantly call Steam.runCallbacks() (preferably in your game loop) in order for your callbacks to be called.

user.onAuthSessionTicketResponse(data)
Parameters:

data (table) –

A result table for when creating an auth session ticket.

  • data.handle (number) The handle for the auth session ticket or 0 if the call failed

  • data.result (string) A steam result, OK if the ticket was created successfully, otherwise an error message

Returns:

nothing

SteamWorks:

GetAuthSessionTicketResponse_t

Posted when an auth session ticket has been accepted or declined by the steam servers. This is in response to a call to user.getAuthSessionTicket().

Example:

function Steam.user.onAuthSessionTicketResponse(data)
    print('Auth ticket issue status:', data.handle, data.result)
end