Type Function Return value Boolean Revision Release 2024.3703 Keywords steam, steamworks, event, addEventListener See also steamworks.removeEventListener() steamworks.*
Adds a listener to the plugin’s collection of event listeners. When the named event occurs, the listener will be invoked and be supplied with a table representing that event.
Returns true
if the listener was successfully added to the plugin. Returns false
if given invalid arguments, such as the listener not being a function or if it’s a table that is missing a function matching the event name.
steamworks.addEventListener( eventName, listener )
String. The name of the event to listen for. Must be one of the following:
Listener. The listener to be invoked when the plugin dispatches an event whose name
property matches the given eventName
argument. This argument must be a function or a table object containing a function having the same name as the event.
local steamworks = require( "plugin.steamworks" ) -- Set up a listener to be called when Steam's overlay has been shown/hidden local function onSteamOverlayStatusChanged( event ) print( "Steam overlay phase: " .. event.phase ) end steamworks.addEventListener( "overlayStatus", onSteamOverlayStatusChanged ) -- Set up a listener to be called when a Steam user's info has been changed local function onSteamUserInfoUpdated( event ) print( "Steam user info has changed." ) end steamworks.addEventListener( "userInfoUpdate", onSteamUserInfoUpdated )