timer.pefrormWithDelay for admob.load

Hello. I’ve placed some interstitial ads on buttons in my game but I don’t want to bother users with ad after ad, I mean like two ads in 20 seconds. I figured out something like this, to delay loading ads.

– if interstitial ad closed, in ad listener
local function delay(event)
timer.performWithDelay(30000, delay)

So now it should delay loading for 30 second, what means if user quickly click another ad button after watching one, it won’t be shown if it isn’t loaded… I’m right? It’s a good way to do that?

Best regards.

I wouldn’t use a timer, instead I’d do something like this:

local lastChecked = 0
local delay = 30000

local function check()
    local time = system.getTimer()
    if time > lastChecked+delay then
        lastChecked = time
        -- Handle ad.

@XeduR thank you so much, you helped me again I really appreciate that.