Type Function Return value none Revision Release 2024.3703 Keywords ads, advertising, Peanut Labs, init See also peanutlabs.show() peanutlabs.*
peanutlabs.init()
initializes the Peanut Labs plugin.
Once initialized, you can show a survey using peanutlabs.show().
peanutlabs.init( listener, params )
Listener. Listener function that will receive adsRequest events.
Table. Table containing Peanut Labs initialization values — see the next section for details.
The params
table includes parameters for PeauntLabs initialization.
String. The ID for the current user of your app.
String. Your Peanut Labs app key, gathered from the PeauntLabs dashboard.
Number. Your Peanut Labs app ID, gathered from the PeauntLabs dashboard.
local peanutlabs = require( "plugin.peanutlabs" ) local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization print( event.provider ) end end -- Initialize the Peanut Labs plugin peanutlabs.init( adListener, { userId = "x1", appKey = "YOUR_APP_KEY", appId = 2222 } )