steam

Version: stable

FUNCTIONS
steam.init()
steam.update()
steam.restart()
steam.finalize()
steam.apps_is_dlc_installed()
steam.friends_get_friend_persona_name()
steam.friends_get_persona_name()
steam.friends_get_persona_state()
steam.friends_get_friend_persona_state()
steam.friends_get_friend_steam_level()
steam.friends_get_friend_relationship()
steam.friends_activate_game_overlay_to_store()
steam.friends_activate_game_overlay_to_web_page()
steam.set_listener()
steam.user_get_steam_id()
steam.user_get_player_steam_level()
steam.user_get_game_badge_level()
steam.user_logged_on()
steam.user_is_behind_nat()
steam.user_is_phone_verified()
steam.user_is_phone_identifying()
steam.user_is_phone_requiring_verification()
steam.user_is_two_factor_enabled()
steam.user_stats_get_stat_int()
steam.user_stats_set_stat_int()
steam.user_stats_get_stat_float()
steam.user_stats_set_stat_float()
steam.user_stats_request_current_stats()
steam.user_stats_request_global_stats()
steam.user_stats_store_stats()
steam.user_stats_reset_all_stats()
steam.user_stats_set_achievement()
steam.user_stats_get_achievement()
steam.user_stats_clear_achievement()
steam.user_stats_get_num_achievements()
steam.user_stats_get_achievement_name()
steam.user_stats_get_achievement_display_attribute()
steam.user_stats_get_achievement_achieved_percent()
steam.user_stats_find_or_create_leaderboard()
steam.user_stats_get_leaderboard_name()
steam.user_stats_get_leaderboard_entry_count()
steam.user_stats_download_leaderboard_entries()
steam.user_stats_get_downloaded_leaderboard_entry()
steam.user_stats_upload_leaderboard_score()
steam.utils_get_app_id()
steam.utils_get_seconds_since_app_active()
steam.utils_is_steam_running_on_steam_deck()
steam.utils_get_image_size()
steam.utils_get_image_rgba()
steam.utils_get_server_real_time()
CONSTANTS
ELeaderboardDataRequestGlobal
ELeaderboardDataRequestGlobalAroundUser
ELeaderboardDataRequestFriends
ELeaderboardSortMethodAscending
ELeaderboardSortMethodNone
ELeaderboardUploadScoreMethodKeepBest
ELeaderboardUploadScoreMethodForceUpdate
ELeaderboardDisplayTypeNumeric
ELeaderboardDisplayTypeTimeSeconds
ELeaderboardDisplayTypeTimeMilliSeconds
EOverlayToStoreFlag_None
EOverlayToStoreFlag_AddToCart
EOverlayToStoreFlag_AddToCartAndShow
EActivateGameOverlayToWebPageMode_Default
EActivateGameOverlayToWebPageMode_Modal
EPersonaStateOffline
EPersonaStateOnline
EPersonaStateBusy
EPersonaStateAway
EPersonaStateSnooze
EPersonaStateLookingToTrade
EPersonaStateLookingToPlay
EPersonaStateInvisible

Functions

steam.init()

steam.init()

Initialize Steamworks.

PARAMETERS

None

RETURNS

Boolean True if successful
String Error message if unsuccessful.

steam.update()

steam.update()

Update Steamworks. Call this from a script component.

PARAMETERS

None


steam.restart()

steam.restart(appid)

Restart Steamworks.

PARAMETERS

appid number

steam.finalize()

steam.finalize()

Finalize Steamworks.

PARAMETERS

None


steam.apps_is_dlc_installed()

steam.apps_is_dlc_installed(app_id)

Takes AppID of DLC and checks if the user owns the DLC & if the DLC is installed.

PARAMETERS

app_id number

RETURNS

bool

steam.friends_get_friend_persona_name()

steam.friends_get_friend_persona_name(CSteamID)

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

CSteamID friendId

RETURNS

name Name of user

steam.friends_get_persona_name()

steam.friends_get_persona_name()

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.

PARAMETERS

None

RETURNS

name Name of user

steam.friends_get_persona_state()

steam.friends_get_persona_state()

Gets the status of the current user. Returned as EPersonaState.

PARAMETERS

None

RETURNS

state Status of user.

steam.friends_get_friend_persona_state()

steam.friends_get_friend_persona_state(steamIDFriend)

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 number Id of friend

RETURNS

state State of friend

steam.friends_get_friend_steam_level()

steam.friends_get_friend_steam_level(steamIDFriend)

Get friends steam level.

PARAMETERS

steamIDFriend number Id of friend

RETURNS

level Steam level of friend

steam.friends_get_friend_relationship()

steam.friends_get_friend_relationship(steamIDFriend)

Returns a relationship to a user.

PARAMETERS

steamIDFriend number Id of friend

RETURNS

relationship Relationship to the user.

steam.friends_activate_game_overlay_to_store()

steam.friends_activate_game_overlay_to_store(app_id,flag)

Activates game overlay to store page for app.

PARAMETERS

app_id number
flag number EOverlayToStoreFlag

steam.friends_activate_game_overlay_to_web_page()

steam.friends_activate_game_overlay_to_web_page(url,mode)

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 string
mode number EActivateGameOverlayToWebPageMode

steam.set_listener()

steam.set_listener(listener)

Set a listener.

PARAMETERS

listener function Listener function to call

steam.user_get_steam_id()

steam.user_get_steam_id()

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.

PARAMETERS

None

RETURNS

CSteamID

steam.user_get_player_steam_level()

steam.user_get_player_steam_level()

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

PARAMETERS

None

RETURNS

number

steam.user_get_game_badge_level()

steam.user_get_game_badge_level()

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).

PARAMETERS

None

RETURNS

number
boolean

steam.user_logged_on()

steam.user_logged_on()

Returns true if the Steam client current has a live connection to the Steam Servers.

PARAMETERS

None

RETURNS

boolean

steam.user_is_behind_nat()

steam.user_is_behind_nat()

Returns true if this users looks like they are behind a NAT device. Only valid once the user has connected to steam .

PARAMETERS

None

RETURNS

boolean

steam.user_is_phone_verified()

steam.user_is_phone_verified()

Gets whether the users phone number is verified.

PARAMETERS

None

RETURNS

boolean

steam.user_is_phone_identifying()

steam.user_is_phone_identifying()

Gets whether the users phone number is identifying.

PARAMETERS

None

RETURNS

boolean

steam.user_is_phone_requiring_verification()

steam.user_is_phone_requiring_verification()

Gets whether the users phone number is awaiting (re)verification.

PARAMETERS

None

RETURNS

boolean

steam.user_is_two_factor_enabled()

steam.user_is_two_factor_enabled()

Gets whether the user has two factor enabled on their account.

PARAMETERS

None

RETURNS

boolean

steam.user_stats_get_stat_int()

steam.user_stats_get_stat_int(id)

Get user stat as an integer.

PARAMETERS

id string Id of the stat to get

RETURNS

ok
stat The stat or nil

steam.user_stats_set_stat_int()

steam.user_stats_set_stat_int(id,stat)

Set user stat.

PARAMETERS

id string Id of the stat to set
stat number Number to set

RETURNS

boolean

steam.user_stats_get_stat_float()

steam.user_stats_get_stat_float(id)

Get user stat as a floating point number.

PARAMETERS

id string Id of the stat to get

RETURNS

Boolean
Number The stat

steam.user_stats_set_stat_float()

steam.user_stats_set_stat_float(id,stat)

Set user stat.

PARAMETERS

id string Id of the stat to set
stat number Number to set

RETURNS

Boolean

steam.user_stats_request_current_stats()

steam.user_stats_request_current_stats()

Ask the server to send down this user's data and achievements for this game.

PARAMETERS

None

RETURNS

Boolean True if successful

steam.user_stats_request_global_stats()

steam.user_stats_request_global_stats(history_days)

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.

PARAMETERS

history_days number

RETURNS

Boolean

steam.user_stats_store_stats()

steam.user_stats_store_stats()

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.

PARAMETERS

None

RETURNS

Boolean

steam.user_stats_reset_all_stats()

steam.user_stats_reset_all_stats(achievements)

Reset stats.

PARAMETERS

achievements boolean True if achievements should be reset as well.

RETURNS

Boolean

steam.user_stats_set_achievement()

steam.user_stats_set_achievement(name)

Set achievement.

PARAMETERS

name string

RETURNS

Boolean

steam.user_stats_get_achievement()

steam.user_stats_get_achievement(name)

Get achievement.

PARAMETERS

name string

RETURNS

Boolean
Boolean

steam.user_stats_clear_achievement()

steam.user_stats_clear_achievement(name)

Clear achievement.

PARAMETERS

name string

RETURNS

Boolean

steam.user_stats_get_num_achievements()

steam.user_stats_get_num_achievements()

Used for iterating achievements. In general games should not need these functions because they should have a list of existing achievements compiled into them.

PARAMETERS

None

RETURNS

Number Number of achievements.

steam.user_stats_get_achievement_name()

steam.user_stats_get_achievement_name(index)

Get achievement name iAchievement in [0,GetNumAchievements)

PARAMETERS

index number

RETURNS

String

steam.user_stats_get_achievement_display_attribute()

steam.user_stats_get_achievement_display_attribute(name,key)

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)

PARAMETERS

name string
key string Either "name", "desc" or "hidden"

RETURNS

String

steam.user_stats_get_achievement_achieved_percent()

steam.user_stats_get_achievement_achieved_percent()

Returns the percentage of users who have achieved the specified achievement.

PARAMETERS

None

RETURNS

Boolean
Number

steam.user_stats_find_or_create_leaderboard()

steam.user_stats_find_or_create_leaderboard(leaderboard_name,eLeaderboardSortMethod,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.

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.

RETURNS

string

steam.user_stats_get_leaderboard_name()

steam.user_stats_get_leaderboard_name(leaderboard)

Get the name of a leaderboard.

PARAMETERS

leaderboard string

RETURNS

string

steam.user_stats_get_leaderboard_entry_count()

steam.user_stats_get_leaderboard_entry_count(leaderboard)

Get the total number of entries in a leaderboard, as of the last request.

PARAMETERS

leaderboard string

RETURNS

number

steam.user_stats_download_leaderboard_entries()

steam.user_stats_download_leaderboard_entries(leaderboard,request,start,end)

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

PARAMETERS

leaderboard string
request ELeaderboardDataRequest
start number
end number

RETURNS

string

steam.user_stats_get_downloaded_leaderboard_entry()

steam.user_stats_get_downloaded_leaderboard_entry(hSteamLeaderboardEntries,index)

Returns data about a single leaderboard entry

PARAMETERS

hSteamLeaderboardEntries string Leaderboard entries handle
index number Which entry to get

RETURNS

Boolean
Table The requested leaderboard entry.

steam.user_stats_upload_leaderboard_score()

steam.user_stats_upload_leaderboard_score(leaderboard,eLeaderboardUploadScoreMethod,nScore)

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.

PARAMETERS

leaderboard string
eLeaderboardUploadScoreMethod ELeaderboardUploadScoreMethod
nScore number

RETURNS

string

steam.utils_get_app_id()

steam.utils_get_app_id()

Returns the appID of the current process.

PARAMETERS

None

RETURNS

Number

steam.utils_get_seconds_since_app_active()

steam.utils_get_seconds_since_app_active()

Return the number of seconds since the user.

PARAMETERS

None

RETURNS

Number

steam.utils_is_steam_running_on_steam_deck()

steam.utils_is_steam_running_on_steam_deck()

Returns true if currently running on the Steam Deck device.

PARAMETERS

None

RETURNS

Boolean

steam.utils_get_image_size()

steam.utils_get_image_size(image)

Get size of image

PARAMETERS

image number Image handle

RETURNS

Boolean True if size of image was read successfully
Number Image width or nil
Number Image height or nil

steam.utils_get_image_rgba()

steam.utils_get_image_rgba(image,size)

Get image in RGBA format.

PARAMETERS

image number Image handle
size number Size of image

RETURNS

Boolean True if size of image was read successfully
String

steam.utils_get_server_real_time()

steam.utils_get_server_real_time()

Returns the Steam server time in Unix epoch format. (Number of seconds since Jan 1, 1970 UTC)

PARAMETERS

None

RETURNS

number Time

Constants

ELeaderboardDataRequestGlobal

Requests rows in the leaderboard from the full table


ELeaderboardDataRequestGlobalAroundUser

Requests rows in the leaderboard from rows around the user


ELeaderboardDataRequestFriends

Requests all the rows for friends of the current user


ELeaderboardSortMethodAscending

Top-score is lowest number


ELeaderboardSortMethodNone

Top-score is highest number


ELeaderboardUploadScoreMethodKeepBest

Leaderboard will keep user's best score


ELeaderboardUploadScoreMethodForceUpdate

Leaderboard will always replace score with specified


ELeaderboardDisplayTypeNumeric

Simple numerical score


ELeaderboardDisplayTypeTimeSeconds

The score represents a time, in seconds


ELeaderboardDisplayTypeTimeMilliSeconds

The score represents a time, in milliseconds


EOverlayToStoreFlag_None

Passed as parameter to the store


EOverlayToStoreFlag_AddToCart

Passed as parameter to the store


EOverlayToStoreFlag_AddToCartAndShow

Passed as parameter to the store


EActivateGameOverlayToWebPageMode_Default

Passed as parameter to ActivateGameOverlayToWebPage


EActivateGameOverlayToWebPageMode_Modal

Passed as parameter to ActivateGameOverlayToWebPage


EPersonaStateOffline

Friend is not currently logged on


EPersonaStateOnline

Friend is logged on


EPersonaStateBusy

User is on, but busy


EPersonaStateAway

Auto-away feature


EPersonaStateSnooze

Auto-away for a long time


EPersonaStateLookingToTrade

Online, trading


EPersonaStateLookingToPlay

Online, wanting to play


EPersonaStateInvisible

Online, but appears offline to friends. This status is never published to clients.