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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
ZO_Object = { }
return newObject
end
---
-- Call ZO_Object:Subclass() to create a new class that inherits from this one.
--
return newClass
end
---
-- Call ZO_Object:MultiSubclass() to create a new class that
-- inherits from multiple parent classes. In situations where the same method is
-- defined on multiple classes, the leftmost class in the argument list takes
-- priority. It is recommended that you override to avoid this!
--
end
end
end
} )
return newClass
end
--[[
Here is a simple multiple inheritence example:
local A = ZO_Object:Subclass()
function A:InitializeA()
self.name = "A"
end
local B = ZO_Object:Subclass()
function B:InitializeB()
self.text = "B"
end
C = ZO_Object.MultiSubclass(A, B)
function C:New()
local obj = ZO_Object.New(self)
obj:Initialize()
return obj
end
function C:Initialize()
self:InitializeA()
self:InitializeB()
end
]] --
return function ( tbl , key )
if dataSource then
end
end
end
end
ZO_DataSourceObject = { }
return newObject
end
end
end
newTemplate . instanceMetaTable = { __index = ZO_GenerateDataSourceMetaTableIndexFunction ( newTemplate ) }
return newTemplate
end
---
-- ZO_InitializingObject is a new Object definition that more directly encodes
-- the practices most current ZO_Objects are actually using. in most cases, you
-- can directly replace a ZO_Object with a ZO_InitializingObject, and delete the
-- redundant :New() definition that most ZO_Object classes create.
--
ZO_InitializingObject = { }
---
-- This is the external constructor for each object. should be called like so:
-- myObject = MyClass:New([arguments])
--
return newObject
end
---
-- Override this initialization function to define how your object should be constructed. example:
-- function MyClass:Initialize(argument1, argument2)
-- self.myField = argument1
-- end
-- You can still create an InitializingObject that doesn't have an Initialize
-- definition, it will just call this empty method instead.
-- To be overridden
end |