diff options
Diffstat (limited to 'Source/Samples/LuaxTest/script.lua')
-rw-r--r-- | Source/Samples/LuaxTest/script.lua | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/Source/Samples/LuaxTest/script.lua b/Source/Samples/LuaxTest/script.lua index df6cbdf..7bf9337 100644 --- a/Source/Samples/LuaxTest/script.lua +++ b/Source/Samples/LuaxTest/script.lua @@ -68,7 +68,7 @@ function main() local Foo = Asura.Class("Foo") Foo.Ctor = function(self, age, name, boy) self.age = age - self.name = boy:GetName() + self.name = name self.boy = boy end Foo.GetAge = function(self) @@ -91,7 +91,7 @@ function main() self.age = age - 1 self.name = boy:GetName() self.boy = boy - self.__base.Ctor(self, age, name, boy) + self.__base.Ctor(self, age, "Wangba", boy) end Coo.GetName = function(self) local name = self.__base.GetName(self) @@ -101,6 +101,8 @@ function main() print(coo2:GetAge()) print(coo2.GetClassName()) print(coo2:GetName()) + print(coo2) + print(coo) ---------------------plain enum test local ERace = Asura.Enum("ERace", { ["White"] = 1, @@ -109,6 +111,22 @@ function main() }) print(ERace.White) print(ERace.Asian) +----------------------native class inherit test + local Boy2 = Asura.SimBoy.Extend("Boy2") + Boy2.Speak = function(self) + return self.__base.GetAge(self) + end + Boy2.Ctor = function(self, age, name) + print("ctor " .. age) + print("ctor " .. name) + end + local boy22 = Boy2.New(12, "Liu") + print(boy22) + print(boy22:Speak()) + +------------------------gc test + local boy = Asura.SimBoy.New(11, "chaichai") + boy = nil end function err(msg) print(msg) |