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


Preloads an ad. Only works with the string "interstitial" for the first argument. Once a ad is loaded or an error occurs, the "adsRequest" listener is called. You can also call ads.isLoaded() to verify the ad has been loaded and ready. You can call to show the ad.


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. Note: At the current time, the test mode only works on Android devices and the iOS Simulator. Test Ads are not working 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 } )