local TestAnimal = class("TestAnimal")
function TestAnimal:__init(name)
self.name = name
end
function TestAnimal:Say()
print("animal saying")
end
return TestAnimal
local TestDog = class("TestDog", require("TestAnimal"))
function TestDog:__init(age)
TestDog.super.__init("SuperBigDog")
self.age = age
end
function TestDog:Say()
TestDog.super.Say(self)
print("Woof! My age is", self.age)
end
return TestDog
local TestCat = class("TestCat", require("TestAnimal"))
function TestCat:__init()
TestCat.super.__init("SuperSmallCat")
end
function TestCat:Say()
TestCat.super.Say(self)
print("Meow!")
end
return TestCat
function CommonProxy:__init()
local TestCat = require("TestFolder.TestCat")
local TestDog = require("TestFolder.TestDog")
local cat = TestCat.new()
local dog = TestDog.new(3)
cat:Say()
dog:Say()
end
function CommonProxy:update()
local res = 0
for i = 1, 50 do
res = res + i
end
print("sum of 1 to 50:", res)
end
function CommonProxy:update()
local res = 0
for i = 1, 100 do
res = res + i
end
print("sum of 1 to 100:", res)
end