olua.lib.Object
| Static Method Summary |
|---|
|
| Constructor Summary |
|---|
|
| Method Summary |
|---|
|
| Method Detail |
|---|
addClassMethodCategory: categoryname withTemplate: template andMetadata: metadataAdds class methods to a class.
Do not use this method --- it is intended for use by the runtime only.
The specified template containing class methods is added to the class. (In the current implementation, the template is executed immediately and the category name discarded.)
See +methodTemplates for information on templates. See
+methodMetadata for information on metadata.
categoryname - the name of the categorytemplate - the method templatemetadata - the metadata table for these methodsaddObjectMethodCategory: categoryname withTemplate: template andMetadata: metadataAdds object methods to a class.
Do not use this method --- it is intended for use by the runtime only.
The specified template containing object methods is added to the class. (In the current implementation, the template is added to the class' template table and executed on object instantiation.)
See +methodTemplates for information on templates.
categoryname - the name of the categorytemplate - the method templatemetadata - the metadata table for these methodsallocCreate a new object.
This method creates an instance of the class. Any code in the class'
statics blocks will be run, but no constructor methods will be.
Normally an init method will then be called on the new returned
object.
createSubclassNamed: nameCreates a new subclass of this class.
Do not use this method --- it is intended for use by the runtime only.
A new class is created as a subclass of this one, with its internal
name field set to the specified value. The class has +superclass,
+name, +methodTemplates and +hash methods predefined,
but no others.
name - the name of the new classhashReturns a hash code for the class.
The hash code is a unique integer identifying the class. It is guaranteed never to be reused. Note that the hash code is not the same as the Lua internal hash.
methodMetadataReturns the table of method metadata for this class.
Do not use this method --- it is intended for use by the runtime only.
This method returns the table of method metadata objects for the class.
The table is keyed by selector (including the initial + or -).
Each item is a table describing an individual method:
category: a string naming the category this method was defined inargtypes: an array of type annotations for the argumentsrettype: the type annotation for the return valuesThe absence of a method in the metadata table should not be considered indicative of the absence of the method! In Objective Lua, any method call may perform work, even if the runtime has defined no method of that name.
Type annotations consist of a list of tokens from the type annotation. Each token is a string. (String tokens contain the quotes.) If the argument had no type annotation, the list is empty.
methodTemplatesReturns the table of method templates for this class.
Do not use this method --- it is intended for use by the runtime only.
This method returns the table of method templates for the class. The
table is keyed by category name, with the default category having
value 1.
Each template is a function with prototype:
function template(self, superclass, class)
When executed, the function adds methods to the table self;
superclass and class are the superclass and class objects
respectively.
nameReturns the name of this class.
superclassReturns the class' superclass.
toStringReturns a string representing this class.
By default, this is [classname class@hashcode] where classname is
the name of the class and hashcode is a unique id.
classReturns the object's class.
forwardInvocation: messageCalled when an unrecognised message is sent to this object.
If a message is sent to the object, and there are no methods that
implement it, the runtime will pass the message to this method.
The object may then do whatever it wishes with it. The default
behaviour is to throw a olua.lib.UnhandledMessageException; if the method
instead returns, the return value will be returned from the original
method.
message - the unrecognised messagehashReturns a hash code for the object.
The hash code is a unique integer identifying the object. It is guaranteed never to be reused. Note that the hash code is not the same as the Lua internal hash.
initInitialises a new instance of the object.
All constructors must, eventually, call this.
isKindOfClass: classTests whether this object inherits from a particular class.
This method returns true if the object is an instance of class, or
of any subclass inheriting from class.
class - the class to test againsttrue or falseisProxyIndicates whether this object is a proxy.
Proxies forward their methods on elsewhere; this method can be used to test for this (so that we know not to trust the class hierarchy, for example).
true or falseoperatorConcatenate: otherCalled on .. operator.
By default, this method performs:
return tostring(self) .. tostring(other)
other - the second operator argumentoperatorIndex: keyCalled when an recognised table key is accessed on the object.
Don't override this unless you really know what you're doing; the
default implementation in olua.lib.Object is required to make
-forwardInvocation: and olua.lib.UnhandledMessageException work.
For most purposes, overriding -forwardInvocation: is the right
thing to do.
key - table key accessedperformSelector: selectorCall a method on the object.
The given no-argument selector is called on the object.
selector - the (mangled) selectorperformSelector: selector withArgs: argsCall a method on the object.
The given selector is called on the object using the supplied arguments.
selector - the (mangled) selectorargs - an array of argumentsrespondsToSelector: selectorTests whether this object responds to a particular selector.
Any class which overrides -forwardInvocation: to do special
behaviour should override this.
selector - the (mangled) selectortrue or falsesuperclassReturns the object's superclass.
toStringReturns a string representing this class.
By default, this is [classname@hashcode] where classname is
the name of the object's class and hashcode is a unique id.