defold/extension-steam/steam
Functions and constants for interacting with Steamworks.
- GitHub: defold/extension-steam — pinned to
1.15.0(released while Defold 1.12.4 was current)- Pick a release from defold/extension-steam releases and add its Source code (zip) URL (or a packaged
.zipasset, if the library ships one) togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as steam from "steam"
- Pick a release from defold/extension-steam releases and add its Source code (zip) URL (or a packaged
Functions
steam.init(): LuaMultiReturn<[boolean, string]>steam.update()steam.restart(appid: number)steam.final()steam.apps_is_dlc_installed(app_id: number): booleansteam.apps_get_current_game_language(): stringsteam.friends_get_friend_persona_name(steamIDFriend: string): stringsteam.friends_get_persona_name(): stringsteam.friends_get_persona_state(): numbersteam.friends_get_friend_count(iFriendFlags: number): numbersteam.friends_get_friend_by_index(iFriend: number, iFriendsFlags: number): stringsteam.friends_get_friend_persona_state(steamIDFriend: string): numbersteam.friends_get_friend_steam_level(steamIDFriend: string): numbersteam.friends_get_friend_relationship(steamIDFriend: string): numbersteam.friends_get_small_friend_avatar(steamIDFriend: string): numbersteam.friends_get_medium_friend_avatar(steamIDFriend: string): numbersteam.friends_get_large_friend_avatar(steamIDFriend: string): numbersteam.friends_activate_game_overlay_to_store(app_id: number, flag: number)steam.friends_activate_game_overlay_to_web_page(url: string, mode: number)steam.friends_set_rich_presence(key: string, value: string): booleansteam.friends_clear_rich_presence()steam.friends_invite_user_to_game(steamIDFriend: string, connect: string): booleansteam.set_listener(listener: function)steam.matchmaking_add_request_lobby_list_string_filter(key: string, value: number, cmp: number)steam.matchmaking_add_request_lobby_list_numerical_filter(key: string, value: number, cmp: number)steam.matchmaking_add_request_lobby_list_near_value_filter(key: string, value: number)steam.matchmaking_add_request_lobby_list_filter_slots_available(slots: number)steam.matchmaking_add_request_lobby_list_distance_filter(dist: number)steam.matchmaking_add_request_lobby_list_result_count_filter(max_count: number)steam.matchmaking_add_request_lobby_list_compatible_members_filter(steam_id: string)steam.matchmaking_request_lobby_list(): stringsteam.matchmaking_get_lobby_by_index(index: number): stringsteam.matchmaking_create_lobby(lobby_type: number, max_members: number): stringsteam.matchmaking_join_lobby(lobby_id: string): stringsteam.matchmaking_leave_lobby(lobby_id: string)steam.matchmaking_get_lobby_owner(lobby_id: string): stringsteam.matchmaking_set_lobby_owner(lobby_id: string, new_owner: string)steam.matchmaking_set_lobby_type(lobby_id: string, type: number)steam.matchmaking_set_lobby_joinable(lobby_id: string, joinable: boolean): booleansteam.matchmaking_set_lobby_member_limit(lobby_id: string, max_members: number): booleansteam.matchmaking_get_lobby_member_limit(lobby_id: string): numbersteam.matchmaking_get_num_lobby_members(lobby_id: string): numbersteam.matchmaking_get_lobby_member_by_index(lobby_id: string, index: number): stringsteam.matchmaking_set_lobby_data(lobby_id: string, key: string, data: string): booleansteam.matchmaking_set_lobby_member_data(lobby_id: string, key: string, data: string)steam.matchmaking_get_lobby_data(lobby_id: string, key: string): stringsteam.matchmaking_get_lobby_member_data(lobby_id: string, user_id: string, key: string): stringsteam.matchmaking_get_lobby_data_count(lobby_id: string): numbersteam.matchmaking_get_lobby_data_by_index(lobby_id: string, index: number): LuaMultiReturn<[boolean, string, string]>steam.matchmaking_send_lobby_chat_message(lobby_id: string, body: string): booleansteam.matchmaking_get_lobby_chat_entry(lobby_id: string, index: number): LuaMultiReturn<[string, string, number]>steam.networking_send_message_to_user(identity_remote: string, data: string, send_flags: number, remote_channel: number)steam.networking_receive_messages_on_channel(localChannel: number): tablesteam.networking_accept_session_with_user(identity_remote: string): booleansteam.networking_close_session_with_user(identity_remote: string): booleansteam.networking_close_channel_with_user(identity_remote: string, local_channel: number): booleansteam.networking_get_session_connection_info(identity_remote: string): tablesteam.remote_storage_file_share(filename: string): stringsteam.remote_storage_get_file_count(): numbersteam.remote_storage_get_file_name_and_size(): numbersteam.remote_storage_get_quota(): LuaMultiReturn<[number, number]>steam.remote_storage_file_write(filename: string, data: string): booleansteam.remote_storage_file_read(filename: string): stringsteam.user_get_steam_id(): stringsteam.user_get_player_steam_level(): numbersteam.user_get_game_badge_level(): LuaMultiReturn<[number, boolean]>steam.user_logged_on(): booleansteam.user_is_behind_nat(): booleansteam.user_is_phone_verified(): booleansteam.user_is_phone_identifying(): booleansteam.user_is_phone_requiring_verification(): booleansteam.user_is_two_factor_enabled(): booleansteam.user_get_auth_session_ticket(): LuaMultiReturn<[string, number, string]>steam.user_begin_auth_session(ticket: string, steamId: string): numbersteam.user_cancel_auth_ticket(ticket: number)steam.user_end_auth_session(steamId: string)steam.user_get_auth_ticket_for_web_api(identity: string): LuaMultiReturn<[number, string]>steam.user_stats_get_stat_int(id: string): LuaMultiReturn<[boolean, number]>steam.user_stats_set_stat_int(id: string, stat: number): booleansteam.user_stats_get_stat_float(id: string): LuaMultiReturn<[boolean, number]>steam.user_stats_set_stat_float(id: string, stat: number): booleansteam.user_stats_request_global_stats(history_days: number): booleansteam.user_stats_store_stats(): booleansteam.user_stats_reset_all_stats(achievements: boolean): booleansteam.user_stats_set_achievement(name: string): booleansteam.user_stats_get_achievement(name: string): LuaMultiReturn<[boolean, boolean]>steam.user_stats_clear_achievement(name: string): booleansteam.user_stats_get_num_achievements(): numbersteam.user_stats_get_achievement_name(index: number): stringsteam.user_stats_get_achievement_display_attribute(name: string, key: string): stringsteam.user_stats_get_achievement_achieved_percent(): LuaMultiReturn<[boolean, number]>steam.user_stats_find_leaderboard(name: string)steam.user_stats_find_or_create_leaderboard(leaderboard_name: string, eLeaderboardSortMethod: ELeaderboardSortMethod, eLeaderboardDisplayType: ELeaderboardDisplayType)steam.user_stats_get_leaderboard_name(leaderboard: string): stringsteam.user_stats_get_leaderboard_entry_count(leaderboard: string): numbersteam.user_stats_get_leaderboard_sort_method(leaderboard: string): numbersteam.user_stats_get_leaderboard_display_type(leaderboard: string): numbersteam.user_stats_download_leaderboard_entries(leaderboard: string, request: ELeaderboardDataRequest, start: number, end: number)steam.user_stats_get_downloaded_leaderboard_entry(hSteamLeaderboardEntries: string, index: number): LuaMultiReturn<[boolean, table]>steam.user_stats_upload_leaderboard_score(leaderboard: string, eLeaderboardUploadScoreMethod: ELeaderboardUploadScoreMethod, nScore: number)steam.user_stats_attach_leadboard_ugc(leaderboard: string, ugc_handle: string): stringsteam.utils_get_app_id(): numbersteam.utils_get_seconds_since_app_active(): numbersteam.utils_is_steam_running_on_steam_deck(): booleansteam.utils_is_steam_overlay_available(): booleansteam.utils_get_image_size(image: number): LuaMultiReturn<[boolean, number, number]>steam.utils_get_image_rgba(image: number, size: number): LuaMultiReturn<[boolean, string]>steam.utils_get_server_real_time(): numbersteam.utils_show_floating_gamepad_text_input(mode: number, x: number, y: number, width: number, height: number): booleansteam.utils_show_gamepad_text_input(input_mode: number, line_input_mode: number, description: string, existing_text: string): boolean
steam.init(): LuaMultiReturn<[boolean, string]>
Initialize Steamworks.
Returns
success:boolean— True if successfulmessage:string— Error message if unsuccessful.
steam.update()
Update Steamworks. Call this from a script component.
steam.restart(appid: number)
Restart Steamworks.
Parameters
appid:number
steam.final()
Finalize Steamworks.
steam.apps_is_dlc_installed(app_id: number): boolean
Takes AppID of DLC and checks if the user owns the DLC & if the DLC is installed.
Parameters
app_id:number
Returns
installed:boolean
steam.apps_get_current_game_language(): string
Gets the current game language.
Returns
language:string
steam.friends_get_friend_persona_name(steamIDFriend: string): string
Returns the name of another user. Same rules as GetFriendPersonaState() apply as to whether or not the user knowns the name of the other user note that on first joining a lobby, chat room or game server the local user will not known the name of the other users automatically; that information will arrive asyncronously.
Parameters
steamIDFriend:string
Returns
name:string— Name of user
steam.friends_get_persona_name(): string
Returns the local players name - guaranteed to not be NULL. This is the same name as on the users community profile page. This is stored in UTF-8 format.
Returns
name:string— Name of user
steam.friends_get_persona_state(): number
Gets the status of the current user. Returned as EPersonaState.
Returns
state:number— Status of user.
steam.friends_get_friend_count(iFriendFlags: number): number
Friend iteration. Takes a set of EFriendFlags, and returns the number of users the client knows about who meet that criteria. Then GetFriendByIndex() can then be used to return the id's of each of those users.
Parameters
iFriendFlags:number— Set of friend flags to match friends against.
Returns
count:number— Number of users matching search.
steam.friends_get_friend_by_index(iFriend: number, iFriendsFlags: number): string
Returns the steamID of a user. The returned CSteamID can then be used by all the functions below to access details about the user.
Parameters
iFriend:number— Is a index of range [0, GetFriendCount()). 0️⃣ 0-based; passed tosteamunchanged.iFriendsFlags:number— Must be the same value as used in GetFriendCount()
Returns
steamID:string— Steam id of the user
steam.friends_get_friend_persona_state(steamIDFriend: string): number
Returns the current status of the specified user. This will only be known by the local user if steamIDFriend is in their friends list; on the same game server; in a chat room or lobby; or in a small group with the local user.
Parameters
steamIDFriend:string— Id of friend
Returns
state:number— State of friend
steam.friends_get_friend_steam_level(steamIDFriend: string): number
Get friends steam level.
Parameters
steamIDFriend:string— Id of friend
Returns
level:number— Steam level of friend
steam.friends_get_friend_relationship(steamIDFriend: string): number
Returns a relationship to a user.
Parameters
steamIDFriend:string— Id of friend
Returns
relationship:number— Relationship to the user.
steam.friends_get_small_friend_avatar(steamIDFriend: string): number
Gets a handle to the small (32*32px) avatar for the specified user. This is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set
Parameters
steamIDFriend:string— Id of friend
Returns
handle:number— Image handle.
steam.friends_get_medium_friend_avatar(steamIDFriend: string): number
Gets a handle to the medium (64*64px) avatar for the specified user. This is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set
Parameters
steamIDFriend:string— Id of friend
Returns
handle:number— Image handle.
steam.friends_get_large_friend_avatar(steamIDFriend: string): number
Gets a handle to the large (128*128px) avatar for the specified user. This is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set
Parameters
steamIDFriend:string— Id of friend
Returns
handle:number— Image handle.
steam.friends_activate_game_overlay_to_store(app_id: number, flag: number)
Activates game overlay to store page for app.
Parameters
app_id:numberflag:number— EOverlayToStoreFlag
steam.friends_activate_game_overlay_to_web_page(url: string, mode: number)
Activates game overlay web browser directly to the specified URL. Full address with protocol type is required, e.g. http://www.steamgames.com/
Parameters
url:stringmode:number— EActivateGameOverlayToWebPageMode
steam.friends_set_rich_presence(key: string, value: string): boolean
Sets a Rich Presence key/value for the current user.
Parameters
key:stringvalue:string
Returns
success:boolean— True if the rich presence was set successfully, otherwise False.
steam.friends_clear_rich_presence()
Clears all of the current user's Rich Presence key/values.
steam.friends_invite_user_to_game(steamIDFriend: string, connect: string): boolean
Invites a friend or clan member to the current game using a special invite string. If the target accepts the invite, a GameRichPresenceJoinRequested_t callback is posted containing the connect string.
Parameters
steamIDFriend:string— Id of friendconnect:string— String
Returns
success:boolean
steam.set_listener(listener: function)
Set a listener.
Parameters
listener:function— Listener function to call
steam.matchmaking_add_request_lobby_list_string_filter(key: string, value: number, cmp: number)
Adds a string comparison filter to the next RequestLobbyList call.
Parameters
key:stringvalue:numbercmp:number
steam.matchmaking_add_request_lobby_list_numerical_filter(key: string, value: number, cmp: number)
Adds a numerical comparison filter to the next RequestLobbyList call.
Parameters
key:stringvalue:numbercmp:number
steam.matchmaking_add_request_lobby_list_near_value_filter(key: string, value: number)
Sorts the results closest to the specified value.
Parameters
key:stringvalue:number
steam.matchmaking_add_request_lobby_list_filter_slots_available(slots: number)
Filters to only return lobbies with the specified number of open slots. Available.
Parameters
slots:number
steam.matchmaking_add_request_lobby_list_distance_filter(dist: number)
Sets the physical distance for which we should search for lobbies, this is. Based on the users IP address and a IP location map on the Steam backed.
Parameters
dist:number
steam.matchmaking_add_request_lobby_list_result_count_filter(max_count: number)
Sets the maximum number of lobbies to return. The lower the count the faster. It is to download the lobby results & details to the client.
Parameters
max_count:number
steam.matchmaking_add_request_lobby_list_compatible_members_filter(steam_id: string)
Unused - Checks the player compatibility based on the frenemy system.
Parameters
steam_id:string
steam.matchmaking_request_lobby_list(): string
Get a filtered list of relevant lobbies. Will return results as a LobbyMatchList_t event
Returns
id:string— Callback id
steam.matchmaking_get_lobby_by_index(index: number): string
Gets the Steam ID of the lobby at the specified index. This should only be called after a LobbyMatchList_t call result is received
Parameters
index:number— The index of the lobby to get the Steam ID of, from 0 to LobbyMatchList_t.m_nLobbiesMatching 0️⃣ 0-based; passed tosteamunchanged.
Returns
id:string— Id of lobby
steam.matchmaking_create_lobby(lobby_type: number, max_members: number): string
Create a new matchmaking lobby. Will generate a LobbyCreated_t, LobbyEnter_t and LobbyDataUpdate_t event
Parameters
lobby_type:number— The type and visibility of this lobby.max_members:number— The maximum number of players that can join this lobby.
Returns
id:string— Callback id
steam.matchmaking_join_lobby(lobby_id: string): string
Joins an existing lobby. Will generate a LobbyEnter_t event
Parameters
lobby_id:string— The Steam ID of the lobby to join.
Returns
id:string— Callback id
steam.matchmaking_leave_lobby(lobby_id: string)
Leave a lobby that the user is currently in. Leave a lobby that the user is currently in; this will take effect immediately on the client side, other users in the lobby will be notified by a LobbyChatUpdate_t callback.
Parameters
lobby_id:string— The lobby to leave
steam.matchmaking_get_lobby_owner(lobby_id: string): string
Returns the current lobby owner. There always one lobby owner - if the current owner leaves, another user in the lobby will become the owner automatically. It is possible (but rare) to join a lobby just as the owner is leaving, thus entering a lobby with self as the owner. You must be a member of the lobby to access this.
Parameters
lobby_id:string— The Steam ID of the lobby to get the owner of.
Returns
id:string— Id of owner
steam.matchmaking_set_lobby_owner(lobby_id: string, new_owner: string)
Changes who the lobby owner is. This can only be set by the owner of the lobby. This will trigger a LobbyDataUpdate_t for all of the users in the lobby, each user should update their local state to reflect the new owner. This is typically accomplished by displaying a crown icon next to the owners name.
Parameters
lobby_id:string— The Steam ID of the lobby to get the owner of.new_owner:string— The new owner
steam.matchmaking_set_lobby_type(lobby_id: string, type: number)
Updates what type of lobby this is. This is also set when you create the lobby with CreateLobby. This can only be set by the owner of the lobby.
Parameters
lobby_id:string— The Steam ID of the lobbytype:number— The lobby type
steam.matchmaking_set_lobby_joinable(lobby_id: string, joinable: boolean): boolean
Sets whether or not a lobby is joinable by other players. This always defaults to enabled for a new lobby. If joining is disabled, then no players can join, even if they are a friend or have been invited. Lobbies with joining disabled will not be returned from a lobby search.
Parameters
lobby_id:string— The Steam ID of the lobbyjoinable:boolean— Enable or disable allowing users to join this lobby?
Returns
result:boolean— Success
steam.matchmaking_set_lobby_member_limit(lobby_id: string, max_members: number): boolean
Set the maximum number of players that can join the lobby. This is also set when you create the lobby with CreateLobby. This can only be set by the owner of the lobby.
Parameters
lobby_id:string— The Steam ID of the lobby to set the member limit for.max_members:number— The maximum number of players allowed in this lobby. This can not be above 250.
Returns
result:boolean— Success
steam.matchmaking_get_lobby_member_limit(lobby_id: string): number
The current limit on the
Parameters
lobby_id:string— The Steam ID of the lobby to get the member limit of.
Returns
limit:number— The current limit
steam.matchmaking_get_num_lobby_members(lobby_id: string): number
Gets the number of users in a lobby. This is used for iteration, after calling this then GetLobbyMemberByIndex can be used to get the Steam ID of each person in the lobby. Persona information for other lobby members (name, avatar, etc.) is automatically received and accessible via the ISteamFriends interface. The current user must be in the lobby to retrieve the Steam IDs of other users in that lobby.
Parameters
lobby_id:string— The Steam ID of the lobby to get the owner of.
Returns
count:number— Number of users in the lobby
steam.matchmaking_get_lobby_member_by_index(lobby_id: string, index: number): string
Gets the Steam ID of the lobby member at the given index. You must call matchmaking_get_num_lobby_members before calling this. The current user must be in the lobby to retrieve the Steam IDs of other users in that lobby.
Parameters
lobby_id:stringindex:number— 0️⃣ 0-based; passed tosteamunchanged.
Returns
id:string— Id of member
steam.matchmaking_set_lobby_data(lobby_id: string, key: string, data: string): boolean
Sets a key/value pair in the lobby metadata.
Parameters
lobby_id:stringkey:stringdata:string
Returns
result:boolean
steam.matchmaking_set_lobby_member_data(lobby_id: string, key: string, data: string)
Sets per-user metadata for the local user.
Parameters
lobby_id:stringkey:stringdata:string
steam.matchmaking_get_lobby_data(lobby_id: string, key: string): string
Get data associated with this lobby.
Parameters
lobby_id:stringkey:string
Returns
data:string— Data
steam.matchmaking_get_lobby_member_data(lobby_id: string, user_id: string, key: string): string
Gets per-user metadata from another player in the specified lobby.
Parameters
lobby_id:stringuser_id:stringkey:string
Returns
data:string— Data
steam.matchmaking_get_lobby_data_count(lobby_id: string): number
Returns the number of metadata keys set on the specified lobby.
Parameters
lobby_id:string
Returns
count:number— Number of keys
steam.matchmaking_get_lobby_data_by_index(lobby_id: string, index: number): LuaMultiReturn<[boolean, string, string]>
Returns a lobby metadata key/values pair by index.
Parameters
lobby_id:stringindex:number— 0️⃣ 0-based; passed tosteamunchanged.
Returns
success:booleankey:stringvalue:string
steam.matchmaking_send_lobby_chat_message(lobby_id: string, body: string): boolean
Broadcasts a chat message to the all the users in the lobby.
Parameters
lobby_id:stringbody:string
Returns
success:boolean
steam.matchmaking_get_lobby_chat_entry(lobby_id: string, index: number): LuaMultiReturn<[string, string, number]>
Get a chat message as specified in a LobbyChatMsg_t callback.
Parameters
lobby_id:stringindex:number
Returns
user:stringdata:stringtype:number
steam.networking_send_message_to_user(identity_remote: string, data: string, send_flags: number, remote_channel: number)
Send message.
Parameters
identity_remote:stringdata:stringsend_flags:number— A bitmask of k_nSteamNetworkingSend_xxx optionsremote_channel:number— A routing number you can use to help route message to different systems
steam.networking_receive_messages_on_channel(localChannel: number): table
Receive message.
Parameters
localChannel:number
Returns
message:table
steam.networking_accept_session_with_user(identity_remote: string): boolean
Accept session. Call this in response to a SteamNetworkingMessagesSessionRequest_t callback.
Parameters
identity_remote:string
Returns
result:boolean— Returns false if there is no session with the user pending or otherwise. If there is an existing active session, this function will return true, even if it is not pending.
steam.networking_close_session_with_user(identity_remote: string): boolean
Close sesssion. Call this when you're done talking to a user to immediately free up resources under-the-hood
Parameters
identity_remote:string
Returns
result:boolean
steam.networking_close_channel_with_user(identity_remote: string, local_channel: number): boolean
Close channel. Call this when you're done talking to a user on a specific channel.
Parameters
identity_remote:stringlocal_channel:number
Returns
result:boolean
steam.networking_get_session_connection_info(identity_remote: string): table
Get connection info. Returns information about the latest state of a connection, if any, with the given peer.
Parameters
identity_remote:string
Returns
info:table— Connection info (state, info, status)
steam.remote_storage_file_share(filename: string): string
Share a file.
Parameters
filename:string— Name of file to share
Returns
id:string
steam.remote_storage_get_file_count(): number
Get number of uploaded files.
Returns
count:number— File count
steam.remote_storage_get_file_name_and_size(): number
Get file information.
Returns
count:number— File count
steam.remote_storage_get_quota(): LuaMultiReturn<[number, number]>
Get storage quota.
Returns
available:number— Available bytestotal:number— Total bytes
steam.remote_storage_file_write(filename: string, data: string): boolean
Creates a new file, writes the bytes to the file, and then closes the file. If the target file already exists, it is overwritten.
Parameters
filename:string— The name of the file to write to.data:string
Returns
result:boolean— Success
steam.remote_storage_file_read(filename: string): string
Opens a binary file, reads the contents of the file into a byte array,. And then closes the file.
Parameters
filename:string— Name of the file to read from
Returns
data:string
steam.user_get_steam_id(): string
Returns the CSteamID of the account currently logged into the Steam client. A CSteamID is a unique identifier for an account, and used to differentiate users in all parts of the Steamworks API.
Returns
id:string
steam.user_get_player_steam_level(): number
Gets the Steam Level of the user, as shown on their profile.
Returns
level:number
steam.user_get_game_badge_level(): LuaMultiReturn<[number, boolean]>
Trading Card badges data access. If you only have one set of cards, the series will be 1. The user has can have two different badges for a series; the regular (max level 5) and the foil (max level 1).
Returns
series:numberfoil:boolean
steam.user_logged_on(): boolean
Returns true if the Steam client current has a live connection to the Steam. Servers.
Returns
logged_on:boolean
steam.user_is_behind_nat(): boolean
Returns true if this users looks like they are behind a NAT device. Only valid once the user has connected to steam .
Returns
behind_nat:boolean
steam.user_is_phone_verified(): boolean
Gets whether the users phone number is verified.
Returns
verified:boolean
steam.user_is_phone_identifying(): boolean
Gets whether the users phone number is identifying.
Returns
verifying:boolean
steam.user_is_phone_requiring_verification(): boolean
Gets whether the users phone number is awaiting (re)verification.
Returns
verification:boolean
steam.user_is_two_factor_enabled(): boolean
Gets whether the user has two factor enabled on their account.
Returns
enabled:boolean
steam.user_get_auth_session_ticket(): LuaMultiReturn<[string, number, string]>
Get an authentication ticket. Retrieve an authentication ticket to be sent to the entity who wishes to authenticate you.
Returns
ticket:string— Auth ticket or nullhandle:number— Ticket handle or nullerror:string— Error message or null
steam.user_begin_auth_session(ticket: string, steamId: string): number
Validate an authentication ticket. Authenticate the ticket from the entity Steam ID to be sure it is valid and isn't reused. Note that identity is not confirmed until the callback ValidateAuthTicketResponse_t is received and the return value in that callback is checked for success.
Parameters
ticket:string— The auth ticket to validatesteamId:string— The entity's Steam ID that sent this ticket.
Returns
result:number
steam.user_cancel_auth_ticket(ticket: number)
Cancels an auth ticket. Cancels an auth ticket received from GetAuthSessionTicket or GetAuthTicketForWebApi. This should be called when no longer playing with the specified entity.
Parameters
ticket:number— The active auth ticket to cancel.
steam.user_end_auth_session(steamId: string)
Ends an auth session. Ends an auth session that was started with BeginAuthSession. This should be called when no longer playing with the specified entity.
Parameters
steamId:string— The entity to end the active auth session with.
steam.user_get_auth_ticket_for_web_api(identity: string): LuaMultiReturn<[number, string]>
Get an authentication ticket for web API. Request an authentication ticket suitable to authenticated in a web backend. Will trigger a GetTicketForWebApiResponse_t callback when the ticket is ready.
Parameters
identity:string— Optional identity string to associate with the ticket
Returns
hAuthTicket:number— The handle of the requested ticketerror:string— Error message or null
steam.user_stats_get_stat_int(id: string): LuaMultiReturn<[boolean, number]>
Get user stat as an integer. Https://partner.steamgames.com/doc/api/ISteamUserStats#GetStat
Parameters
id:string— Id of the stat to get
Returns
ok:booleanstat:number— The stat or nil
steam.user_stats_set_stat_int(id: string, stat: number): boolean
Set user stat. Https://partner.steamgames.com/doc/api/ISteamUserStats#SetStat
Parameters
id:string— Id of the stat to setstat:number— Number to set
Returns
ok:boolean
steam.user_stats_get_stat_float(id: string): LuaMultiReturn<[boolean, number]>
Get user stat as a floating point number. Https://partner.steamgames.com/doc/api/ISteamUserStats#GetStat
Parameters
id:string— Id of the stat to get
Returns
ok:booleanstat:number— The stat
steam.user_stats_set_stat_float(id: string, stat: number): boolean
Set user stat. Https://partner.steamgames.com/doc/api/ISteamUserStats#SetStat
Parameters
id:string— Id of the stat to setstat:number— Number to set
Returns
ok:boolean
steam.user_stats_request_global_stats(history_days: number): boolean
Requests global stats data, which is available for stats marked as "aggregated". This call is asynchronous, with the results returned in GlobalStatsReceived_t. nHistoryDays specifies how many days of day-by-day history to retrieve in addition to the overall totals. The limit is 60. https://partner.steamgames.com/doc/api/ISteamUserStats#RequestGlobalStats
Parameters
history_days:number
Returns
ok:boolean
steam.user_stats_store_stats(): boolean
Store the current data on the server. Will get a callback when set and one callback for every new achievement If the callback has a result of k_EResultInvalidParam, one or more stats uploaded has been rejected, either because they broke constraints or were out of date. In this case the server sends back updated values. The stats should be re-iterated to keep in sync. https://partner.steamgames.com/doc/api/ISteamUserStats#StoreStats
Returns
ok:boolean
steam.user_stats_reset_all_stats(achievements: boolean): boolean
Reset stats. Https://partner.steamgames.com/doc/api/ISteamUserStats#ResetAllStats
Parameters
achievements:boolean— True if achievements should be reset as well.
Returns
ok:boolean
steam.user_stats_set_achievement(name: string): boolean
Set achievement. Https://partner.steamgames.com/doc/api/ISteamUserStats#SetAchievement
Parameters
name:string
Returns
ok:boolean
steam.user_stats_get_achievement(name: string): LuaMultiReturn<[boolean, boolean]>
Get achievement. Https://partner.steamgames.com/doc/api/ISteamUserStats#GetAchievement
Parameters
name:string
Returns
ok:booleanachieved:boolean
steam.user_stats_clear_achievement(name: string): boolean
Clear achievement. Https://partner.steamgames.com/doc/api/ISteamUserStats#ClearAchievement
Parameters
name:string
Returns
ok:boolean
steam.user_stats_get_num_achievements(): number
Used for iterating achievements. In general games should not need these functions because they should have a list of existing achievements compiled into them. https://partner.steamgames.com/doc/api/ISteamUserStats#GetNumAchievements
Returns
num:number— Number of achievements.
steam.user_stats_get_achievement_name(index: number): string
Get achievement name iAchievement in [0,GetNumAchievements). Https://partner.steamgames.com/doc/api/ISteamUserStats#GetAchievementName
Parameters
index:number— 0️⃣ 0-based; passed tosteamunchanged.
Returns
name:string
steam.user_stats_get_achievement_display_attribute(name: string, key: string): string
Get general attributes for an achievement. Accepts the following keys * "name" and "desc" for retrieving the localized achievement name and description (returned in UTF8) * "hidden" for retrieving if an achievement is hidden (returns "0" when not hidden, "1" when hidden) https://partner.steamgames.com/doc/api/ISteamUserStats#GetAchievementDisplayAttribute
Parameters
name:stringkey:string— Either "name", "desc" or "hidden"
Returns
attribute:string
steam.user_stats_get_achievement_achieved_percent(): LuaMultiReturn<[boolean, number]>
Returns the percentage of users who have achieved the specified achievement. Https://partner.steamgames.com/doc/api/ISteamUserStats#GetAchievementAchievedPercent
Returns
ok:booleanpercent:number
steam.user_stats_find_leaderboard(name: string)
Find a leaderboard. Will return leaderboard asynchronously. https://partner.steamgames.com/doc/api/ISteamUserStats#FindLeaderboard
Parameters
name:string
steam.user_stats_find_or_create_leaderboard(leaderboard_name: string, eLeaderboardSortMethod: ELeaderboardSortMethod, eLeaderboardDisplayType: ELeaderboardDisplayType)
Gets a leaderboard by name, it will create it if it's not yet created. This call is asynchronous, with the result returned in a listener callback with event set to LeaderboardFindResult_t. https://partner.steamgames.com/doc/api/ISteamUserStats#FindOrCreateLeaderboard
Parameters
leaderboard_name:string— The name of the leaderboard to find or create.eLeaderboardSortMethod:ELeaderboardSortMethod— The sort order of the new leaderboard if it's created.eLeaderboardDisplayType:ELeaderboardDisplayType— The display type (used by the Steam Community web site) of the new leaderboard if it's created.
steam.user_stats_get_leaderboard_name(leaderboard: string): string
Get the name of a leaderboard. Https://partner.steamgames.com/doc/api/ISteamUserStats#GetLeaderboardName
Parameters
leaderboard:string
Returns
name:string
steam.user_stats_get_leaderboard_entry_count(leaderboard: string): number
Get the total number of entries in a leaderboard, as of the last request. Https://partner.steamgames.com/doc/api/ISteamUserStats#GetLeaderboardEntryCount
Parameters
leaderboard:string
Returns
count:number
steam.user_stats_get_leaderboard_sort_method(leaderboard: string): number
Returns the sort method of the leaderboard. Https://partner.steamgames.com/doc/api/ISteamUserStats#GetLeaderboardSortMethod
Parameters
leaderboard:string
Returns
sort_order:number
steam.user_stats_get_leaderboard_display_type(leaderboard: string): number
Returns the display type of a leaderboard handle. Https://partner.steamgames.com/doc/api/ISteamUserStats#GetLeaderboardDisplayType
Parameters
leaderboard:string
Returns
display_type:number
steam.user_stats_download_leaderboard_entries(leaderboard: string, request: ELeaderboardDataRequest, start: number, end: number)
Asks the Steam back-end for a set of rows in the leaderboard. This call is asynchronous, with the result returned in a listener callback with event set to LeaderboardScoresDownloaded_t. LeaderboardScoresDownloaded_t will contain a handle to pull the results from GetDownloadedLeaderboardEntries(). You can ask for more entries than exist, and it will return as many as do exist. * k_ELeaderboardDataRequestGlobal requests rows in the leaderboard from the full table, with nRangeStart & nRangeEnd in the range [1, TotalEntries] * k_ELeaderboardDataRequestGlobalAroundUser requests rows around the current user, nRangeStart being negate e.g. DownloadLeaderboardEntries( hLeaderboard, k_ELeaderboardDataRequestGlobalAroundUser, -3, 3 ) will return 7 rows, 3 before the user, 3 after * k_ELeaderboardDataRequestFriends requests all the rows for friends of the current user https://partner.steamgames.com/doc/api/ISteamUserStats#DownloadLeaderboardEntries
Parameters
leaderboard:stringrequest:ELeaderboardDataRequeststart:numberend:number
steam.user_stats_get_downloaded_leaderboard_entry(hSteamLeaderboardEntries: string, index: number): LuaMultiReturn<[boolean, table]>
Returns data about a single leaderboard entry. Https://partner.steamgames.com/doc/api/ISteamUserStats#GetDownloadedLeaderboardEntry
Parameters
hSteamLeaderboardEntries:string— Leaderboard entries handleindex:number— Which entry to get. 0️⃣ 0-based; passed tosteamunchanged.
Returns
ok:booleanentry:table— The requested leaderboard entry.
steam.user_stats_upload_leaderboard_score(leaderboard: string, eLeaderboardUploadScoreMethod: ELeaderboardUploadScoreMethod, nScore: number)
Uploads a user score to a specified leaderboard. This call is asynchronous, with the result returned in a listener callback with event set to LeaderboardScoreUploaded_t. https://partner.steamgames.com/doc/api/ISteamUserStats#UploadLeaderboardScore
Parameters
leaderboard:stringeLeaderboardUploadScoreMethod:ELeaderboardUploadScoreMethodnScore:number
steam.user_stats_attach_leadboard_ugc(leaderboard: string, ugc_handle: string): string
Attaches a piece of user generated content the current user's entry on a. Leaderboard. https://partner.steamgames.com/doc/api/ISteamUserStats#AttachLeaderboardUGC
Parameters
leaderboard:stringugc_handle:string
Returns
Steam:string— API call id
steam.utils_get_app_id(): number
Returns the appID of the current process.
Returns
app_id:number
steam.utils_get_seconds_since_app_active(): number
Return the number of seconds since the user.
Returns
seconds:number
steam.utils_is_steam_running_on_steam_deck(): boolean
Returns true if currently running on the Steam Deck device.
Returns
running_on_steamdeck:boolean
steam.utils_is_steam_overlay_available(): boolean
Returns true if the Steam Overlay is running and the user can access it.
Returns
steam_overlay_available:boolean
steam.utils_get_image_size(image: number): LuaMultiReturn<[boolean, number, number]>
Get size of image.
Parameters
image:number— Image handle
Returns
ok:boolean— True if size of image was read successfullywidth:number— Image width or nilheight:number— Image height or nil
steam.utils_get_image_rgba(image: number, size: number): LuaMultiReturn<[boolean, string]>
Get image in RGBA format.
Parameters
image:number— Image handlesize:number— Size of image
Returns
ok:boolean— True if size of image was read successfullyImage:string
steam.utils_get_server_real_time(): number
Returns the Steam server time in Unix epoch format. (Number of seconds since Jan 1, 1970 UTC).
Returns
Server:number— Time
steam.utils_show_floating_gamepad_text_input(mode: number, x: number, y: number, width: number, height: number): boolean
Opens a floating keyboard over the game content and sends OS keyboard keys directly to the game.
Parameters
mode:number— EFloatingGamepadTextInputModex:number— Text field x positiony:number— Text field y positionwidth:number— Text field widthheight:number— Text field height
Returns
result:boolean— True if the floating keyboard was shown, otherwise, false.
steam.utils_show_gamepad_text_input(input_mode: number, line_input_mode: number, description: string, existing_text: string): boolean
Activates the Big Picture text input dialog which only supports gamepad input.
Parameters
input_mode:number— EGamepadTextInputModeline_input_mode:number— EGamepadTextInputLineModedescription:string— Sets the description that should inform the user what the input dialog is forexisting_text:string— Sets the preexisting text which the user can edit.
Returns
result:boolean— True if the big picture overlay is running; otherwise, false
Constants
steam.EFloatingGamepadTextInputModeModeSingleLine
Enter dismisses the keyboard
steam.EFloatingGamepadTextInputModeModeMultipleLines
User needs to explicitly dismiss the keyboard
steam.EFloatingGamepadTextInputModeModeEmail
Keyboard is displayed in a special mode that makes it easier to enter emails
steam.EFloatingGamepadTextInputModeModeNumeric
Numeric keypad is shown
steam.EGamepadTextInputModeNormal
Normal text input
steam.EGamepadTextInputModePassword
Password text input
steam.EGamepadTextInputLineModeSingleLine
Single line text
steam.EGamepadTextInputLineModeMultipleLines
Multi line text
steam.ELeaderboardDataRequestGlobal
Requests rows in the leaderboard from the full table.
steam.ELeaderboardDataRequestGlobalAroundUser
Requests rows in the leaderboard from rows around the user.
steam.ELeaderboardDataRequestFriends
Requests all the rows for friends of the current user.
steam.ELeaderboardSortMethodNone
steam.ELeaderboardSortMethodAscending
Top-score is lowest number.
steam.ELeaderboardSortMethodDescending
Top-score is highest number.
steam.ELeaderboardUploadScoreMethodNone
steam.ELeaderboardUploadScoreMethodKeepBest
Leaderboard will keep user's best score.
steam.ELeaderboardUploadScoreMethodForceUpdate
Leaderboard will always replace score with specified.
steam.ELeaderboardDisplayTypeNone
steam.ELeaderboardDisplayTypeNumeric
Simple numerical score.
steam.ELeaderboardDisplayTypeTimeSeconds
The score represents a time, in seconds.
steam.ELeaderboardDisplayTypeTimeMilliSeconds
The score represents a time, in milliseconds.
steam.EOverlayToStoreFlag_None
Passed as parameter to the store.
steam.EOverlayToStoreFlag_AddToCart
Passed as parameter to the store.
steam.EOverlayToStoreFlag_AddToCartAndShow
Passed as parameter to the store.
steam.EActivateGameOverlayToWebPageMode_Default
Passed as parameter to ActivateGameOverlayToWebPage.
steam.EActivateGameOverlayToWebPageMode_Modal
Passed as parameter to ActivateGameOverlayToWebPage.
steam.EPersonaStateOffline
Friend is not currently logged on.
steam.EPersonaStateOnline
Friend is logged on.
steam.EPersonaStateBusy
User is on, but busy.
steam.EPersonaStateAway
Auto-away feature.
steam.EPersonaStateSnooze
Auto-away for a long time.
steam.EPersonaStateLookingToTrade
Online, trading.
steam.EPersonaStateLookingToPlay
Online, wanting to play.
steam.EPersonaStateInvisible
Online, but appears offline to friends. This status is never published to clients.
steam.EFriendFlagNone
EFriendFlagNone
steam.EFriendFlagBlocked
EFriendFlagBlocked
steam.EFriendFlagFriendshipRequested
EFriendFlagFriendshipRequested
steam.EFriendFlagImmediate
EFriendFlagImmediate
steam.EFriendFlagClanMember
EFriendFlagClanMember
steam.EFriendFlagOnGameServer
EFriendFlagOnGameServer
steam.EFriendFlagRequestingFriendship
EFriendFlagRequestingFriendship
steam.EFriendFlagRequestingInfo
EFriendFlagRequestingInfo
steam.EFriendFlagIgnored
EFriendFlagIgnored
steam.EFriendFlagIgnoredFriend
EFriendFlagIgnoredFriend
steam.EFriendFlagChatMember
EFriendFlagChatMember
steam.EFriendFlagAll
EFriendFlagAll
steam.SteamNetworkingSend_Unreliable
SteamNetworkingSend_Unreliable
steam.SteamNetworkingSend_NoNagle
SteamNetworkingSend_NoNagle
steam.SteamNetworkingSend_UnreliableNoNagle
SteamNetworkingSend_UnreliableNoNagle
steam.SteamNetworkingSend_NoDelay
SteamNetworkingSend_NoDelay
steam.SteamNetworkingSend_UnreliableNoDelay
SteamNetworkingSend_UnreliableNoDelay
steam.SteamNetworkingSend_Reliable
SteamNetworkingSend_Reliable
steam.SteamNetworkingSend_ReliableNoNagle
SteamNetworkingSend_ReliableNoNagle
steam.SteamNetworkingSend_UseCurrentThread
SteamNetworkingSend_UseCurrentThread
steam.SteamNetworkingSend_AutoRestartBrokenSession
SteamNetworkingSend_AutoRestartBrokenSession
steam.ESteamNetConnectionEnd_Invalid
ESteamNetConnectionEnd_Invalid
steam.ESteamNetConnectionEnd_App_Generic
ESteamNetConnectionEnd_App_Generic
steam.ESteamNetConnectionEnd_AppException_Generic
ESteamNetConnectionEnd_AppException_Generic
steam.ESteamNetConnectionEnd_Local_OfflineMode
ESteamNetConnectionEnd_Local_OfflineMode
steam.ESteamNetConnectionEnd_Local_ManyRelayConnectivity
ESteamNetConnectionEnd_Local_ManyRelayConnectivity
steam.ESteamNetConnectionEnd_Local_HostedServerPrimaryRelay
ESteamNetConnectionEnd_Local_HostedServerPrimaryRelay
steam.ESteamNetConnectionEnd_Local_NetworkConfig
ESteamNetConnectionEnd_Local_NetworkConfig
steam.ESteamNetConnectionEnd_Local_Rights
ESteamNetConnectionEnd_Local_Rights
steam.ESteamNetConnectionEnd_Local_P2P_ICE_NoPublicAddresses
ESteamNetConnectionEnd_Local_P2P_ICE_NoPublicAddresses
steam.ESteamNetConnectionEnd_Remote_Timeout
ESteamNetConnectionEnd_Remote_Timeout
steam.ESteamNetConnectionEnd_Remote_BadCrypt
ESteamNetConnectionEnd_Remote_BadCrypt
steam.ESteamNetConnectionEnd_Remote_BadCert
ESteamNetConnectionEnd_Remote_BadCert
steam.ESteamNetConnectionEnd_Remote_BadProtocolVersion
ESteamNetConnectionEnd_Remote_BadProtocolVersion
steam.ESteamNetConnectionEnd_Remote_P2P_ICE_NoPublicAddresses
ESteamNetConnectionEnd_Remote_P2P_ICE_NoPublicAddresses
steam.ESteamNetConnectionEnd_Misc_Generic
ESteamNetConnectionEnd_Misc_Generic
steam.ESteamNetConnectionEnd_Misc_InternalError
ESteamNetConnectionEnd_Misc_InternalError
steam.ESteamNetConnectionEnd_Misc_Timeout
ESteamNetConnectionEnd_Misc_Timeout
steam.ESteamNetConnectionEnd_Misc_SteamConnectivity
ESteamNetConnectionEnd_Misc_SteamConnectivity
steam.ESteamNetConnectionEnd_Misc_NoRelaySessionsToClient
ESteamNetConnectionEnd_Misc_NoRelaySessionsToClient
steam.ESteamNetConnectionEnd_Misc_P2P_Rendezvous
ESteamNetConnectionEnd_Misc_P2P_Rendezvous
steam.ESteamNetConnectionEnd_Misc_P2P_NAT_Firewall
ESteamNetConnectionEnd_Misc_P2P_NAT_Firewall
steam.ESteamNetConnectionEnd_Misc_PeerSentNoConnection
ESteamNetConnectionEnd_Misc_PeerSentNoConnection
steam.ESteamNetworkingConnectionState_None
ESteamNetworkingConnectionState_None
steam.ESteamNetworkingConnectionState_Connecting
ESteamNetworkingConnectionState_Connecting
steam.ESteamNetworkingConnectionState_FindingRoute
ESteamNetworkingConnectionState_FindingRoute
steam.ESteamNetworkingConnectionState_Connected
ESteamNetworkingConnectionState_Connected
steam.ESteamNetworkingConnectionState_ClosedByPeer
ESteamNetworkingConnectionState_ClosedByPeer
steam.ESteamNetworkingConnectionState_ProblemDetectedLocally
ESteamNetworkingConnectionState_ProblemDetectedLocally
steam.ELobbyTypePrivate
ELobbyTypePrivate only way to join the lobby is to invite to someone else
steam.ELobbyTypeFriendsOnly
ELobbyTypeFriendsOnly shows for friends or invitees, but not in lobby list
steam.ELobbyTypePublic
ELobbyTypePublic visible for friends and in lobby list
steam.ELobbyTypeInvisible
ELobbyTypeInvisible returned by search, but not visible to other friends
steam.ELobbyTypePrivateUnique
ELobbyTypePrivateUnique private, unique and does not delete when empty
steam.EAuthSessionResponseOK
EAuthSessionResponseOK Steam has verified the user is online, the ticket is valid and ticket has not been reused.
steam.EAuthSessionResponseUserNotConnectedToSteam
EAuthSessionResponseUserNotConnectedToSteam The user in question is not connected to steam.
steam.EAuthSessionResponseNoLicenseOrExpired
EAuthSessionResponseNoLicenseOrExpired The user doesn't have a license for this App ID or the ticket has expired.
steam.EAuthSessionResponseVACBanned
EAuthSessionResponseVACBanned The user is VAC banned for this game.
steam.EAuthSessionResponseLoggedInElseWhere
EAuthSessionResponseLoggedInElseWhere The user account has logged in elsewhere and the session containing the game instance has been disconnected.
steam.EAuthSessionResponseVACCheckTimedOut
EAuthSessionResponseVACCheckTimedOut VAC has been unable to perform anti-cheat checks on this user.
steam.EAuthSessionResponseAuthTicketCanceled
EAuthSessionResponseAuthTicketCanceled The ticket has been canceled by the issuer.
steam.EAuthSessionResponseAuthTicketInvalidAlreadyUsed
EAuthSessionResponseAuthTicketInvalidAlreadyUsed This ticket has already been used, it is not valid.
steam.EAuthSessionResponseAuthTicketInvalid
EAuthSessionResponseAuthTicketInvalid This ticket is not from a user instance currently connected to steam.
steam.EAuthSessionResponsePublisherIssuedBan
EAuthSessionResponsePublisherIssuedBan The user is banned for this game. The ban came via the web api and not VAC.
steam.EAuthSessionResponseAuthTicketNetworkIdentityFailure
EAuthSessionResponseAuthTicketNetworkIdentityFailure The network identity in the ticket does not match the server authenticating the ticket.