summaryrefslogtreecommitdiff
path: root/Source/Samples/LuaxTest/script.lua
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-03-19 23:06:27 +0800
committerchai <chaifix@163.com>2019-03-19 23:06:27 +0800
commit1497dccd63a84b7ee2b229b1ad9c5c02718f2a78 (patch)
treef8d1bff50da13e126d08c7345653e002e293202d /Source/Samples/LuaxTest/script.lua
parent5e2a973516e0729b225da9de0b03015dc5854ac4 (diff)
*rename
Diffstat (limited to 'Source/Samples/LuaxTest/script.lua')
-rw-r--r--Source/Samples/LuaxTest/script.lua138
1 files changed, 0 insertions, 138 deletions
diff --git a/Source/Samples/LuaxTest/script.lua b/Source/Samples/LuaxTest/script.lua
deleted file mode 100644
index 7bf9337..0000000
--- a/Source/Samples/LuaxTest/script.lua
+++ /dev/null
@@ -1,138 +0,0 @@
-string script = R"scriptcode(
--- start script
-
-function main()
- local a = 19
- print(Asura.version)
- print(Asura.author.name)
- print("ok")
- print(Asura.author.func())
--- local boy = Asura.SimBoy.New("I am peter!", 19)
--- boy:Say()
--- print(Asura.SimSchool.GetName())
- print(Asura.SimBoy.Class)
- print(Asura.SimBoy.Gender)
- print(Asura.SimBoy.GetClassName())
- print(Asura.School.GetName())
- print(Asura.School.Region)
---[[
- local Kid = Asura.SimBoy.Extend()
- Asura.Kid = Kid
- Kid.New = function(self, height, age)
- self.base(age)
- self.height = height
- end
- Kid.GetHeight = function(self)
- print(self.height)
- end
- local kid = Kid.New(110, 12)
- kid:GetHeight()
- ]]
- local kid = Asura.SimBoy.New(23, "Chai")
- print(kid:GetAge())
- print(kid:GetName())
- kid.fruit = function()
- return "apple"
- end
- print(kid.fruit())
- print(Asura.SimBoy.GetGender())
- Asura.SimBoy.Havefun = function()
- return "Boys have some fun!"
- end
- print(Asura.SimBoy.Havefun())
-
--- ޸෽
- Asura.SimBoy.Foo = function()
- return "SimBoy.Foo"
- end
- print(Asura.SimBoy.Foo())
-
- print(Asura.EGender.BOY)
- --Asura.EGender.BOY = 2
- print(Asura.EGender.BOY)
- print(Asura.SimBoy.EHabits.Girls)
- print(Asura.EHabits.Girls)
- print(kid)
-
- kid:Write(function()
- return "kid:Write()"
- end )
- print(kid:Speak())
-
- kid:Write(function()
- 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 = name
- 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.GetClassName())
- print(foo.boy:GetAge())
---------------------inherits test
- local Coo = Foo.Extend("Coo")
- print(Coo.GetClassName())
- local coo = Coo.New(20, "Wang", kid)
- print(coo:GetAge())
- Coo.Ctor = function(self, age, name, boy)
- self.age = age - 1
- self.name = boy:GetName()
- self.boy = boy
- self.__base.Ctor(self, age, "Wangba", boy)
- end
- Coo.GetName = function(self)
- local name = self.__base.GetName(self)
- return "his name is " .. name
- end
- local coo2 = Coo.New(20, "Wang", kid)
- print(coo2:GetAge())
- print(coo2.GetClassName())
- print(coo2:GetName())
- print(coo2)
- print(coo)
----------------------plain enum test
- local ERace = Asura.Enum("ERace", {
- ["White"] = 1,
- ["Asian"] = 2,
- ["Black"] = 3,
- })
- 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)
-end
-xpcall(main, err)
-
-
--- end script
-)scriptcode"; \ No newline at end of file