Do you have a function for your adListener?
Your logic also doesn’t make sense. ads.isLoaded() won’t return true until you have called ads.load(“interstitial”). You seem to be missing that step. But even then it’s a bit more complex than simply calling ads.load() because this is an asynchronous operation. That is ads.load() takes time and runs in the background immediately returning control to your program. Thus if you do:
ads.load(“interstitial”)
if (ads.isLoaded(“interstitial”) then
— do stuff
end
The return will always be false because the isLoaded test happens immediately before ads.load() has a chance to actually load the ad. The right logic is one of two choices:
Ignore pre-loading and just call ads.show(“interstitial”)
This is the simplest option, but the ad shows when it’s ready, and not so much when you want it too.
If you know your going to show the ad at a certain point and can a few seconds earlier preload the ad, call ads.load(“interstitial”) when you have time to load the ad. Then when you’re ready to actually show the code call your ads.isLoaded/ads.show code above.
Rob