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:
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_tand a boolean
- Returns:
(uint64)
SteamAPICall_thandle for this async call. The result is delivered via thecallbackparameter whenSteam.RunCallbacks()is called.- SteamWorks:
- Utils.DismissFloatingGamepadTextInput()
🤖 Auto-generated binding
- Returns:
(bool) Return value
- SteamWorks:
- Utils.DismissGamepadTextInput()
🤖 Auto-generated binding
- Returns:
(bool) Return value
- SteamWorks:
- 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. Ifnilthen the buffer will beNULL.
- Returns:
(int) Return value
- Returns:
(str)
pchOutFilteredText- SteamWorks:
Signature differences from C++ API:
Parameter
pchOutFilteredTextis 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:
- Utils.GetAPICallResult(hSteamAPICall, cubCallback, iCallbackExpected)
🤖 Auto-generated binding
- Parameters:
hSteamAPICall (uint64) –
cubCallback (int?) – size of the buffer to allocate for
pCallback. Ifnilthen the buffer will beNULL.iCallbackExpected (int) –
- Returns:
(bool) Return value
- Returns:
(str)
pCallback- Returns:
(bool)
pbFailed- SteamWorks:
Signature differences from C++ API:
Parameter
pCallbackis not a parameter in Lua — it is an output-only pointer in C++ and is returned as an additional return value.Parameter
pbFailedis not a parameter in Lua — it is an output-only pointer in C++ and is returned as an additional return value.
Example:
print("My app id is " .. Steam.Utils.GetAppID())
- Utils.GetConnectedUniverse()
🤖 Auto-generated binding
- Returns:
(int - EUniverse) Return value
- SteamWorks:
- Utils.GetCurrentBatteryPower()
🤖 Auto-generated binding
- Returns:
(int) Return value
- SteamWorks:
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. Ifnilthen the buffer will beNULL.- Returns:
(bool) Return value
- Returns:
(str)
pchText- SteamWorks:
Signature differences from C++ API:
Parameter
pchTextis 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:
- Utils.GetIPCCallCount()
🤖 Auto-generated binding
- Returns:
(int) Return value
- SteamWorks:
- Utils.GetIPCountry()
🤖 Auto-generated binding
- Returns:
(str) Return value
- SteamWorks:
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:
- Utils.GetImageRGBA(iImage, nDestBufferSize)
🤖 Auto-generated binding
- Parameters:
iImage (int) –
nDestBufferSize (int?) – size of the buffer to allocate for
pubDest. Ifnilthen the buffer will beNULL.
- Returns:
(bool) Return value
- Returns:
(str)
pubDest- SteamWorks:
Signature differences from C++ API:
Parameter
pubDestis 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:
Signature differences from C++ API:
Parameter
pnWidthis not a parameter in Lua — it is an output-only pointer in C++ and is returned as an additional return value.Parameter
pnHeightis 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:
Example:
local seconds = Steam.Utils.GetSecondsSinceAppActive()
print('App active for ' .. seconds .. ' seconds')
- Utils.GetSecondsSinceComputerActive()
🤖 Auto-generated binding
- Returns:
(int) Return value
- SteamWorks:
- Utils.GetServerRealTime()
🤖 Auto-generated binding
- Returns:
(int) Return value
- SteamWorks:
Example:
local realTime = Steam.Utils.GetServerRealTime()
print('Steam server time: ' .. realTime)
- Utils.GetSteamUILanguage()
🤖 Auto-generated binding
- Returns:
(str) Return value
- SteamWorks:
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:
- Utils.IsAPICallCompleted(hSteamAPICall)
🤖 Auto-generated binding
- Parameters:
hSteamAPICall (uint64) –
- Returns:
(bool) Return value
- Returns:
(bool)
pbFailed- SteamWorks:
Signature differences from C++ API:
Parameter
pbFailedis 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:
Example:
if not Steam.Utils.IsOverlayEnabled() then
print('Steam overlay is disabled')
end
- Utils.IsSteamChinaLauncher()
🤖 Auto-generated binding
- Returns:
(bool) Return value
- SteamWorks:
- Utils.IsSteamInBigPictureMode()
🤖 Auto-generated binding
- Returns:
(bool) Return value
- SteamWorks:
Example:
if Steam.Utils.IsSteamInBigPictureMode() then
-- Use controller-friendly UI
end
- Utils.IsSteamRunningInVR()
🤖 Auto-generated binding
- Returns:
(bool) Return value
- SteamWorks:
Example:
if Steam.Utils.IsSteamRunningInVR() then
enableVRMode()
end
- Utils.IsSteamRunningOnSteamDeck()
🤖 Auto-generated binding
- Returns:
(bool) Return value
- SteamWorks:
Example:
if Steam.Utils.IsSteamRunningOnSteamDeck() then
-- Enable Steam Deck specific controls
end
- Utils.IsVRHeadsetStreamingEnabled()
🤖 Auto-generated binding
- Returns:
(bool) Return value
- SteamWorks:
- Utils.SetGameLauncherMode(bLauncherMode)
🤖 Auto-generated binding
- Parameters:
bLauncherMode (bool) –
- SteamWorks:
- Utils.SetOverlayNotificationInset(nHorizontalInset, nVerticalInset)
🤖 Auto-generated binding
- Parameters:
nHorizontalInset (int) –
nVerticalInset (int) –
- SteamWorks:
Example:
Steam.Utils.SetOverlayNotificationInset(10, 10)
- Utils.SetOverlayNotificationPosition(eNotificationPosition)
🤖 Auto-generated binding
- Parameters:
eNotificationPosition (int - ENotificationPosition) –
- SteamWorks:
Example:
Steam.Utils.SetOverlayNotificationPosition(Steam.k_EPositionTopRight)
- Utils.SetVRHeadsetStreamingEnabled(bEnabled)
🤖 Auto-generated binding
- Parameters:
bEnabled (bool) –
- SteamWorks:
- 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:
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:
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:
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)