Type Function
Return value Boolean
Revision 2018.3332
Keywords steam, steamworks, event, addEventListener
See also steamworks.removeEventListener()


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 )
eventName (required)

String. The name of the event to listen for. Must be one of the following:

listener (required)

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 )
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." )
steamworks.addEventListener( "userInfoUpdate", onSteamUserInfoUpdated )