-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGeneralExample.lua
More file actions
62 lines (57 loc) · 1.16 KB
/
GeneralExample.lua
File metadata and controls
62 lines (57 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
local LuaClasses = require('Classes')
function PrintATable(Table)
for i, Value in pairs(Table) do
print(Value)
end
end
local Birds = {
beak = "long",
wings = "short",
tail = "short",
I_Belive_I_Can_Fly = function ()
print("I am flying!")
end
}
local Non_flying_birds = {
Is_A_Penguin = true
}
LuaClasses.Inherit(Non_flying_birds, Birds)
LuaClasses.ExceptMethods(Non_flying_birds, {"I_Belive_I_Can_Fly"})
local Penguin = LuaClasses.NewObject(Non_flying_birds,
{
beak = "Medium",
wings = "Medium",
tail = "Short",
Good_At_Sliding = true;
})
PrintATable(Penguin)
Components = {
Fly = function()
local feet = math.random(0, 1000)
print("I am flying ".. feet .." feet in the air!")
end,
Era = "Jurrasic",
Mammal = false,
Species = "T-Rex";
xPos = 100,
yPos = 0,
zPos = 30,
BeatenBoss = false;
}
local Dinosour = {
Nails = "Long",
Arms = "Short",
Is_Predator = true
}
LuaClasses.Compile(Dinosour, Components)
local T_Rex = LuaClasses.NewObject(Dinosour, {})
LuaClasses.ExceptMethods(T_Rex,
{
"BeatenBoss",
"xPos",
"yPos",
"zPos",
"Fly"
})
PrintATable(T_Rex)
Components.Fly()