ISteamUtils

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.

Note

This interface can be accessed has multiple accessors (e.g. a GameServer variant), the documentation shows Utils everywhere but it can also be accessed with GameServerUtils.

List of Functions

List of Callbacks

Function Reference

Utils.BOverlayNeedsPresent()

🤖 Auto-generated binding

Returns:

(bool) Return value

SteamWorks:

BOverlayNeedsPresent

Example:

-- Call after rendering your frame
if Steam.Utils.BOverlayNeedsPresent() then
    presentFrame()
end
Utils.CheckFileSignature(szFileName, callback)

🤖 Auto-generated binding

Parameters:
  • szFileName (str?) –

  • callback (function) – CallResult callback receiving struct CheckFileSignature_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:

CheckFileSignature

Utils.DismissFloatingGamepadTextInput()

🤖 Auto-generated binding

Returns:

(bool) Return value

SteamWorks:

DismissFloatingGamepadTextInput

Utils.DismissGamepadTextInput()

🤖 Auto-generated binding

Returns:

(bool) Return value

SteamWorks:

DismissGamepadTextInput

Utils.FilterText(eContext, sourceSteamID, pchInputMessage, nByteSizeOutFilteredText)

🤖 Auto-generated binding

Parameters:
  • eContext (int - ETextFilteringContext) –

  • sourceSteamID (uint64 - CSteamID) –

  • pchInputMessage (str?) –

  • nByteSizeOutFilteredText (int?) – size of the buffer to allocate for pchOutFilteredText. If nil then the buffer will be NULL.

Returns:

(int) Return value

Returns:

(str) pchOutFilteredText

SteamWorks:

FilterText

Signature differences from C++ API:

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

Example:

local ok, filtered = Steam.Utils.FilterText('Chat', Steam.User.GetSteamID(), userInput, #userInput + 1)
if ok then
    displayMessage(filtered)
end
Utils.GetAPICallFailureReason(hSteamAPICall)

🤖 Auto-generated binding

Parameters:

hSteamAPICall (uint64) –

Returns:

(int - ESteamAPICallFailure) Return value

SteamWorks:

GetAPICallFailureReason

Utils.GetAPICallResult(hSteamAPICall, cubCallback, iCallbackExpected)

🤖 Auto-generated binding

Parameters:
  • hSteamAPICall (uint64) –

  • cubCallback (int?) – size of the buffer to allocate for pCallback. If nil then the buffer will be NULL.

  • iCallbackExpected (int) –

Returns:

(bool) Return value

Returns:

(str) pCallback

Returns:

(bool) pbFailed

SteamWorks:

GetAPICallResult

Signature differences from C++ API:

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

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

Utils.GetAppID()

🤖 Auto-generated binding

Returns:

(int) Return value

SteamWorks:

GetAppID

Example:

print("My app id is " .. Steam.Utils.GetAppID())
Utils.GetConnectedUniverse()

🤖 Auto-generated binding

Returns:

(int - EUniverse) Return value

SteamWorks:

GetConnectedUniverse

Utils.GetCurrentBatteryPower()

🤖 Auto-generated binding

Returns:

(int) Return value

SteamWorks:

GetCurrentBatteryPower

Example:

local power = Steam.Utils.GetCurrentBatteryPower()
if power < 20 then
    print('Low battery: ' .. power .. '%')
end
Utils.GetEnteredGamepadTextInput(cchText)

🤖 Auto-generated binding

Parameters:

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

Returns:

(bool) Return value

Returns:

(str) pchText

SteamWorks:

GetEnteredGamepadTextInput

Signature differences from C++ API:

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

Utils.GetEnteredGamepadTextLength()

🤖 Auto-generated binding

Returns:

(int) Return value

SteamWorks:

GetEnteredGamepadTextLength

Utils.GetIPCCallCount()

🤖 Auto-generated binding

Returns:

(int) Return value

SteamWorks:

GetIPCCallCount

Utils.GetIPCountry()

🤖 Auto-generated binding

Returns:

(str) Return value

SteamWorks:

GetIPCountry

Example:

local country = Steam.Utils.GetIPCountry()
print('Player is from: ' .. country)
Utils.GetIPv6ConnectivityState(eProtocol)

🤖 Auto-generated binding

Parameters:

eProtocol (int - ESteamIPv6ConnectivityProtocol) –

Returns:

(int - ESteamIPv6ConnectivityState) Return value

SteamWorks:

GetIPv6ConnectivityState

Utils.GetImageRGBA(iImage, nDestBufferSize)

🤖 Auto-generated binding

Parameters:
  • iImage (int) –

  • nDestBufferSize (int?) – size of the buffer to allocate for pubDest. If nil then the buffer will be NULL.

Returns:

(bool) Return value

Returns:

(str) pubDest

SteamWorks:

GetImageRGBA

Signature differences from C++ API:

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

Example:

local _, w, h = Steam.Utils.GetImageSize(imageHandle)
local ok, rgba = Steam.Utils.GetImageRGBA(imageHandle, w * h * 4)
if ok then
    -- rgba is a string of raw RGBA bytes; upload to a texture
    uploadTexture(rgba, w, h)
end
Utils.GetImageSize(iImage)

🤖 Auto-generated binding

Parameters:

iImage (int) –

Returns:

(bool) Return value

Returns:

(int) pnWidth

Returns:

(int) pnHeight

SteamWorks:

GetImageSize

Signature differences from C++ API:

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

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

Example:

local _, w, h = Steam.Utils.GetImageSize(imageHandle)
print(string.format('Image: %dx%d', w, h))
Utils.GetSecondsSinceAppActive()

🤖 Auto-generated binding

Returns:

(int) Return value

SteamWorks:

GetSecondsSinceAppActive

Example:

local seconds = Steam.Utils.GetSecondsSinceAppActive()
print('App active for ' .. seconds .. ' seconds')
Utils.GetSecondsSinceComputerActive()

🤖 Auto-generated binding

Returns:

(int) Return value

SteamWorks:

GetSecondsSinceComputerActive

Utils.GetServerRealTime()

🤖 Auto-generated binding

Returns:

(int) Return value

SteamWorks:

GetServerRealTime

Example:

local realTime = Steam.Utils.GetServerRealTime()
print('Steam server time: ' .. realTime)
Utils.GetSteamUILanguage()

🤖 Auto-generated binding

Returns:

(str) Return value

SteamWorks:

GetSteamUILanguage

Example:

local lang = Steam.Utils.GetSteamUILanguage()
print('Steam UI language: ' .. lang)
Utils.InitFilterText(unFilterOptions)

🤖 Auto-generated binding

Parameters:

unFilterOptions (int) –

Returns:

(bool) Return value

SteamWorks:

InitFilterText

Utils.IsAPICallCompleted(hSteamAPICall)

🤖 Auto-generated binding

Parameters:

hSteamAPICall (uint64) –

Returns:

(bool) Return value

Returns:

(bool) pbFailed

SteamWorks:

IsAPICallCompleted

Signature differences from C++ API:

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

Utils.IsOverlayEnabled()

🤖 Auto-generated binding

Returns:

(bool) Return value

SteamWorks:

IsOverlayEnabled

Example:

if not Steam.Utils.IsOverlayEnabled() then
    print('Steam overlay is disabled')
end
Utils.IsSteamChinaLauncher()

🤖 Auto-generated binding

Returns:

(bool) Return value

SteamWorks:

IsSteamChinaLauncher

Utils.IsSteamInBigPictureMode()

🤖 Auto-generated binding

Returns:

(bool) Return value

SteamWorks:

IsSteamInBigPictureMode

Example:

if Steam.Utils.IsSteamInBigPictureMode() then
    -- Use controller-friendly UI
end
Utils.IsSteamRunningInVR()

🤖 Auto-generated binding

Returns:

(bool) Return value

SteamWorks:

IsSteamRunningInVR

Example:

if Steam.Utils.IsSteamRunningInVR() then
    enableVRMode()
end
Utils.IsSteamRunningOnSteamDeck()

🤖 Auto-generated binding

Returns:

(bool) Return value

SteamWorks:

IsSteamRunningOnSteamDeck

Example:

if Steam.Utils.IsSteamRunningOnSteamDeck() then
    -- Enable Steam Deck specific controls
end
Utils.IsVRHeadsetStreamingEnabled()

🤖 Auto-generated binding

Returns:

(bool) Return value

SteamWorks:

IsVRHeadsetStreamingEnabled

Utils.SetGameLauncherMode(bLauncherMode)

🤖 Auto-generated binding

Parameters:

bLauncherMode (bool) –

SteamWorks:

SetGameLauncherMode

Utils.SetOverlayNotificationInset(nHorizontalInset, nVerticalInset)

🤖 Auto-generated binding

Parameters:
  • nHorizontalInset (int) –

  • nVerticalInset (int) –

SteamWorks:

SetOverlayNotificationInset

Example:

Steam.Utils.SetOverlayNotificationInset(10, 10)
Utils.SetOverlayNotificationPosition(eNotificationPosition)

🤖 Auto-generated binding

Parameters:

eNotificationPosition (int - ENotificationPosition) –

SteamWorks:

SetOverlayNotificationPosition

Example:

Steam.Utils.SetOverlayNotificationPosition(Steam.k_EPositionTopRight)
Utils.SetVRHeadsetStreamingEnabled(bEnabled)

🤖 Auto-generated binding

Parameters:

bEnabled (bool) –

SteamWorks:

SetVRHeadsetStreamingEnabled

Utils.ShowFloatingGamepadTextInput(eKeyboardMode, nTextFieldXPosition, nTextFieldYPosition, nTextFieldWidth, nTextFieldHeight)

🤖 Auto-generated binding

Parameters:
  • eKeyboardMode (int - EFloatingGamepadTextInputMode) –

  • nTextFieldXPosition (int) –

  • nTextFieldYPosition (int) –

  • nTextFieldWidth (int) –

  • nTextFieldHeight (int) –

Returns:

(bool) Return value

SteamWorks:

ShowFloatingGamepadTextInput

Example:

-- For bottom of window use 0,0,0,0
-- For top of window use 0,windowHeight/2,windowWidth,windowHeight/2
local SingleLine = Steam.k_EFloatingGamepadTextInputModeModeSingleLine
Steam.Utils.ShowFloatingGamepadTextInput(SingleLine, x, y, w, h)
Utils.ShowGamepadTextInput(eInputMode, eLineInputMode, pchDescription, unCharMax, pchExistingText)

🤖 Auto-generated binding

Parameters:
  • eInputMode (int - EGamepadTextInputMode) –

  • eLineInputMode (int - EGamepadTextInputLineMode) –

  • pchDescription (str?) –

  • unCharMax (int) –

  • pchExistingText (str?) –

Returns:

(bool) Return value

SteamWorks:

ShowGamepadTextInput

Example:

local Normal = Steam.k_EGamepadTextInputModeNormal
local SingleLine = Steam.k_EGamepadTextInputLineModeSingleLine
Steam.Utils.ShowGamepadTextInput(Normal, SingleLine, 'Enter your name', 64, existing_name)
Utils.StartVRDashboard()

🤖 Auto-generated binding

SteamWorks:

StartVRDashboard

Callbacks

Utils.OnIPCountry()

Callback for IPCountry_t

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

Example:

function Steam.Utils.OnIPCountry()
    print('IP country changed to: ' .. Steam.Utils.GetIPCountry())
end
Utils.OnLowBatteryPower()

Callback for LowBatteryPower_t

callback(data) receives:

  • data.m_nMinutesBatteryLeft (int)

Example:

function Steam.Utils.OnLowBatteryPower(data)
    print('Low battery warning: ' .. data.m_nMinutesBatteryLeft .. ' minutes left')
end
Utils.OnSteamAPICallCompleted()

Callback for SteamAPICallCompleted_t

callback(data) receives:

  • data.m_hAsyncCall (uint64 - SteamAPICall_t)

  • data.m_iCallback (int)

  • data.m_cubParam (int)

Utils.OnSteamShutdown()

Callback for SteamShutdown_t

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

Example:

function Steam.Utils.OnSteamShutdown()
    print('Steam is shutting down, saving game...')
    saveGame()
end
Utils.OnCheckFileSignature()

Callback for CheckFileSignature_t

callback(data) receives:

  • data.m_eCheckFileSignature (int - ECheckFileSignature)

Utils.OnGamepadTextInputDismissed()

Callback for GamepadTextInputDismissed_t

callback(data) receives:

  • data.m_bSubmitted (bool)

  • data.m_unSubmittedText (int)

  • data.m_unAppID (int - AppId_t)

Example:

function Steam.Utils.OnGamepadTextInputDismissed(data)
    if not data.m_bSubmitted then return end  -- User canceled
    local length = Steam.Utils.GetEnteredGamepadTextLength()
    local newstring = Steam.Utils.GetEnteredGamepadTextInput(length)
    -- Use the string entered by the user
end
Utils.OnAppResumingFromSuspend()

Callback for AppResumingFromSuspend_t

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

Utils.OnFloatingGamepadTextInputDismissed()

Callback for FloatingGamepadTextInputDismissed_t

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

Example:

function Steam.Utils.OnFloatingGamepadTextInputDismissed()
    -- Floating keyboard was closed
end
Utils.OnFilterTextDictionaryChanged()

Callback for FilterTextDictionaryChanged_t

callback(data) receives:

  • data.m_eLanguage (int)