Question about Timer DOCS...

I’m still learning so bear with me if you will…Thanks! lol :stuck_out_tongue:

Okay so I was reading this concerning the Timer.performWithDelay command-

listener (required)

Listener.

The listener to invoke after the delay. May be either a function listener or a table listener. If a table, it must have a timer method because timer events are sent to the listener.

from this part of the DOCS located here - http://docs.coronalabs.com/api/library/timer/performWithDelay.html

Question is, the part where is says,

“If a table, it must have a timer method because timer events are sent to the listener.”

What does this mean? I’m just not getting it. Any help would be appreciated. Perhaps an example? Thanks again! B)

Read about ‘table listeners’ in lua on corona page.

The idea is simple if you read about it.

[lua]
local function doSth()
end
timer.performWithDelay(1000, doSth)

–method with table listeners
local someTable = {}
someTable.myNum = 25
function someTable:timer(event)
print(self.myNum) --self is parameter as ‘event’ but hidden because of usage of ‘:’
end
timer.performWithDelay(2000, someTable) --will print ‘25’
[/lua]

Read about ‘table listeners’ in lua on corona page.

The idea is simple if you read about it.

[lua]
local function doSth()
end
timer.performWithDelay(1000, doSth)

–method with table listeners
local someTable = {}
someTable.myNum = 25
function someTable:timer(event)
print(self.myNum) --self is parameter as ‘event’ but hidden because of usage of ‘:’
end
timer.performWithDelay(2000, someTable) --will print ‘25’
[/lua]