Type Function
Return value none
Revision Current Public Release (2016.2992)
Keywords ads, advertising, admob
See also


Preloads an ad. Only works with the string "interstitial" for the first argument. You can also call ads.isLoaded() to verify that the ad has been loaded and to show it.


ads.load( adUnitType [, params] )
adUnitType (required)

String. The type of ad to show. AdMob supports "interstitial" for this command.

params (optional)

Table. A table that specifies properties for the ad request — see the next section for details.

Parameter Reference

The params table can include properties for the ad request.

appId (optional)

String. The app ID. If this is not specified, the value provided to ads.init() is used instead.

testMode (optional)

Boolean. Set to true to enable test ads and false for regular ads. At this time, test mode only works on Android devices and in the Xcode Simulator. Test ads do not work on iOS devices.


local ads = require( "ads" )

local function adListener( event )
    if ( event.isError ) then
        -- Failed to receive an ad
    else "interstitial", { x=0, y=0, appId="otherAppId" } )

ads.init( "admob", "myAppId", adListener )

ads.load( "interstitial", { appId="otherAppId", testMode=false } )