diff options
author | chai <chaifix@163.com> | 2019-03-17 20:36:39 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-03-17 20:36:39 +0800 |
commit | 34fe8e795aaeed3a9f50d895d1cadd8f124c9605 (patch) | |
tree | 9242101b5d08474bf68aefe1c9ea8bb024a8cfb1 /Source/Samples/LuaxTest/script.lua | |
parent | af78bbf9f1ea499be92611aa4a63664d79d13b25 (diff) |
*luax
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) |