Created
October 20, 2014 10:59
-
-
Save paidi/5e2bd9931f3f7535258e to your computer and use it in GitHub Desktop.
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
local Adder = {} | |
Adder.__index = Adder | |
function Adder.new() | |
local adder = {} | |
setmetatable(adder, Adder) | |
adder.total = 0 | |
return adder | |
end | |
function Adder:add(i) | |
self.total = self.total + i | |
end | |
local adder = Adder.new() | |
for i=1,1000000 do | |
adder:add(i) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment