Because I get a ads.height() is nil error when my scene takes some seconds to load.
Hi @gainsempire,
May I ask why you need to show an ad at one point then get its height later? Why can’t you just store the height of the current ad in a variable and then access that variable later? Or show the ad after the scene loads, which is probably a better approach anyway?
What’s up with ‘ads:setCurrentProvider( “admob” )’ ?
Anyway, i do check for nil value and don’t do anything if so.
Here is my whole code. Works for me :
Main part is below. Attached file is the whole code with my own codings.
local showAd local ads = require "ads" local function adListener( event ) if event.isError then else local height = ads.height() end end function showAd( adType, options ) ads.show( adType, { x=adXPos, y=adYPos, interval = 10, testMode = sg\_adMob.isTestMode } ) end ads.init( sg\_adMob.provider, sg\_adMob.id, adListener )