Skip to content

Commit

Permalink
renaming "public" to "o"
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlindquist committed Aug 15, 2011
1 parent 1f4592d commit 10309fb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions luna/Model.lua
@@ -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
10 changes: 5 additions & 5 deletions luna/View.lua
@@ -1,8 +1,8 @@
return function()
local public = {}
local o = {}

local scoreDisplay
function public:getScoreDisplay()
function o:getScoreDisplay()
return scoreDisplay
end

Expand All @@ -11,7 +11,7 @@ return function()
scoreDisplay.text = event.data
end

function public:tap(event)
function o:tap(event)
--send a "tap" to anyone listening by receive("tap")
self:dispatchEvent({ name = "scoreTap", data = 0 })

Expand All @@ -23,7 +23,7 @@ return function()
end

--init is called automatically
function public:init()
function o:init()
scoreDisplay = display.newText("Woo haa!", 0, 0, native.systemFont, 16)

scoreDisplay:setTextColor(255, 255, 255)
Expand All @@ -33,5 +33,5 @@ return function()
self:addEventListener("timeChange", onTimeChanged)
end

return public
return o
end

0 comments on commit 10309fb

Please sign in to comment.