Putting luup all together

Have a scene that I only want triggered a maximum of once a hour. Using:

local result = true
local now = os.time()
if (LastTime) then
result = now - LastTime >3600
end
LastTime = now
return result

However if the scene is tripped I want to play a wave file. Using:

os.execute(‘curl -g “http://192.168.100.49:8080/requests/status.xml?command=in_play&input=file:///c:/audio/nofreeze.wav”’)

They work fine if I just use one or the other but how can I combine the code together. End result is if the scene is triggered play the wave file but only trigger the scene a maximum of once a hour. Thanks

local result = true
local now = os.time()
if (LastTime) then
    result = now - LastTime >3600
end
if (result) then
    LastTime = now
    os.execute('curl -g "http://192.168.100.49:8080/requests/status.xml?command=in_play&input=file:///c:/audio/nofreeze.wav"')
end
return result

I also fixed a bug in your logic … you should have only set LastTime if result was true!
The way you had it, if you triggered every 30 minutes it would never fire.

Thanks for the quick response Richard. Better yet thanks for the explanation, it goes a long way in helping me better understand this code. :).