i’m trying to put a banner ad on the menu scene. i’m getting this error.
Runtime error
c:\users\me\documents\corona projects\game1\menu.lua:51: attempt to call field ‘init’ (a nil value)
stack traceback:
[C]: in function ‘error’
?: in function ‘gotoScene’
c:\users\me\documents\corona projects\game1\main.lua:15: in main chunk
main.lua is just
display.setStatusBar( display.HiddenStatusBar )
local composer = require “composer”
composer.gotoScene( “menu” )
the ads script in menu.lua is
local ads = require( “ads” )
local appID = “ca-app-pub-nnnnnnnnnnn/nnnnnnnnn” <<in the app i used my real code here
local bannerAppID = “ca-app-pub-nnnnnnnnnnn/nnnnnnnnn” <<same code here
local adProvider = “admob”
local function adListener( event )
– The ‘event’ table includes:
– event.name: string value of “adsRequest”
– event.response: message from the ad provider about the status of this request
– event.phase: string value of “loaded”, “shown”, or “refresh”
– event.type: string value of “banner” or “interstitial”
– event.isError: boolean true or false
local msg = event.response
– Quick debug message regarding the response from the library
print( "Message from the ads library: ", msg )
if ( event.isError ) then
print( “Error, no ad received”, msg )
else
print( “Ah ha! Got one!” )
end
end
ads.init( adProvider, appID, adListener )
ads.show( “banner”, { x=0, y=0, appId=bannerAppID } )
i added in build.settings
plugins = { [“plugin.google.play.services”] = { publisherId = “com.coronalabs” }, },
can anyone point me in the right direction?