From ad2805aa839892589c13a615730da52f6e474709 Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 17 Mar 2019 10:49:50 +0800 Subject: *luax --- Source/Samples/LuaxTest/script.lua | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'Source/Samples/LuaxTest/script.lua') diff --git a/Source/Samples/LuaxTest/script.lua b/Source/Samples/LuaxTest/script.lua index 32bd8e8..97890c0 100644 --- a/Source/Samples/LuaxTest/script.lua +++ b/Source/Samples/LuaxTest/script.lua @@ -63,7 +63,24 @@ function main() return "kid:Write() 2" end ) print(kid:Speak()) - + +------------------- plain class test + local Foo = Asura.Class("Foo") + Foo.Ctor = function(self, age, name, boy) + self.age = age + self.name = boy:GetName() + self.boy = boy + end + Foo.GetAge = function(self) + return self.age + end + Foo.GetName = function(self) + return self.name + end + local foo = Foo.New(10, "lee", kid) + print(foo:GetName()) + print(Foo.GetClassName()) + print(foo.boy:GetAge()) end function err(msg) print(msg) -- cgit v1.1-26-g67d0