Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f4592d
commit 10309fb
Showing
2 changed files
with
12 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
return function() | ||
local public = {} | ||
local o = {} | ||
|
||
local currentTime | ||
function public:getCurrentTime() | ||
function o:getCurrentTime() | ||
return currentTime | ||
end | ||
|
||
function public:setCurrentTime(value) | ||
function o:setCurrentTime(value) | ||
currentTime = value | ||
self:dispatchEvent({name = "timeChange", data = currentTime}) | ||
end | ||
|
||
local someTable = {} | ||
function someTable:scoreTap(event) | ||
public:setCurrentTime(event.data) | ||
o:setCurrentTime(event.data) | ||
end | ||
|
||
function public:timer() | ||
function o:timer() | ||
self:setCurrentTime(currentTime + 1) | ||
end | ||
|
||
function public:init(startingTime) | ||
function o:init(startingTime) | ||
self:setCurrentTime(startingTime) | ||
--example of a "table listener" | ||
self:addEventListener("scoreTap", someTable) --If you don't include the second param, it will default to "self" | ||
timer.performWithDelay(1000, self, 0) | ||
end | ||
|
||
return public | ||
return o | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters