steamworks.removeEventListener()

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

Overview

Removes a listener that was once added to the plugin via the steamworks.addEventListener() function. This prevents that listener from being invoked for its corresponding event.

Returns true if the listener was successfully removed from the plugin. Returns false if given invalid arguments or if the given listener reference has not been added to the plugin.

Syntax

steamworks.removeEventListener( eventName, listener )
eventName (required)

String. The name of the event to stop listening to. Must be one of the following:

listener (required)

Listener. Reference to the same listener that was originally added to the steamworks.addEventListener() function.

Example

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 )

-- Sometime later, stop listening to the Steam overlay that was set
steamworks.removeEventListener( "overlayStatus", onSteamOverlayStatusChanged )