Besides the API described here, ClassHandler-1.0 also shares all the methods from EmbedHandler-1.0
self:NewClass(id [, object])
Embeds all the methods from ClassHandler-1.0 (and EmbedHandler) into the provided object or into an empty table, and registers it in the library database according to its id.
Returns
The class object
Parameters
- id
- The value that identifies the class when calling other methods from this library (see below)
- object
- The object to be embedded and registered as a class
Notes
Notice that, as all the methods from ClassHandler are embedded into to the class, it can create new classes and embed new objects by itself:
local Class = LibStub("ClassHandler-1.0"):NewClass('MyClass') local SubClass = Class:NewClass('MySubClass')
self:GetClass(id)
Returns a class object according to the id provided from the library database. Notice that classes are not stored only by their id's, but also by the "self" arg:
-- This two calls won't return the same value CallbackHandler:GetClass('SomeID') ~= MyObject:GetClass('SomeID')
-- This two calls will return the same value CallbackHandler.GetClass(MyObject, 'SomeID') == MyObject:GetClass('SomeID')
self:IterateClasses()
Returns an iterator of the classes registered for the "self" arg:
for id, class in MyObject:IterateClasses() do -- Iterates over the classes created by MyObject end
Facts
- Date created
- Dec 09, 2009
- Last updated
- Dec 10, 2009