superawesome.isLoaded()

Type Function
Return value Boolean
Revision Release 2022.3683
Keywords ads, advertising, SuperAwesome, isLoaded
See also superawesome.show()
superawesome.load()
superawesome.*

Overview

Checks whether an ad is already loaded. Returns true if an ad is loaded/ready, otherwise returns false.

Syntax

superawesome.isLoaded( placementID )
placementID (required)

String. The placement ID for the ad, retrieved from the SuperAwesome dashboard.

Example

local superawesome = require( "plugin.superawesome" )

-- Pre-declare a placement ID
local myPlacementID = "YOUR_PLACEMENT_ID"

local function adListener( event )

    if ( event.phase == "init" ) then  -- Successful initialization
        -- Load a banner ad
        superawesome.load( "banner", { placementId=myPlacementID } )
    end
end

-- Initialize the SuperAwesome plugin
superawesome.init( adListener, { testMode=true } )

-- Sometime later, check if the ad is loaded
local isAdLoaded = superawesome.isLoaded( myPlacementID )
print( isAdLoaded )