The "TADS Object" intrinsic class. All objects that the program defines with the "class" or "object" statements descend from this class.
Modified in debug.t[354]:
Provide TadsObject with an objToString() method so that the EVALUATE command can display some kind of name of the object via the toString() function
Modified in signals.t[150]:
MODIFICATIONS TO TadsObject for SIGNALS EXTENSION
Add handling for emiting, handling and dispatching signals.
Copy a method or property from the self object to obj. obj is the object to copy from. prop is a pointer to the property or method to copy. newProp is a pointer to the property or method on obj to copy to; if this parameter is not supplied it defaults to prop. If prop is a method or double-quoted string we copy the code across, otherwise we copy the value of what self.prop contains. If obj does not define prop we don't do anything at all.
Create a clone of this object. This creates an exact copy, with the same property values, as the original. This does not call any constructors; it merely instantiates an exact copy of the original.
Note that the clone is a "shallow" copy, which means that any objects it references are not themselves cloned.
Create an instance of this object: in other words, create a new object whose superclass is this object. The arguments provided are passed to the new object's constructor. This method returns a reference to the new object.
Create a transient instance of this object. This works just like createInstance(), but creates a transient instance instead of an ordinary (persistent) instance.
Dispatch a signal to the appropriate handler method on this object. We look up the property pointer to use on the signal's dispatchTab LookupTable. If we find one and the property is defined on this object then we use that property to handle the signal. Otherwise, we simply use our catch-all generic handle(sender, signal) method.
Get a method value. If the property is a method, this returns a function pointer to the method; this does NOT evaluate the method. If the property is not a method, this returns nil.
The returned function pointer can be called like an ordinary function, but such a call will have no 'self' value, so the disembodied method won't be able to refer to properties or methods of 'self'. The main use of this method is to get a method of one object to assign as a method of another object using setMethod().
Handle a signal from sender; game code will need to override particular instances. Note that this is a catch-all handler for signals we don't recognize or for which more specific handlers haven't been defined. [SIGNALS EXTENSION]
Move a method or property from self to obj. This does exactly the same as copyMethod() except that after the method or property has been copied to obj, it is effectively deleted from self by being set to nil. The idea is that if this method is called at preinit and the method or property is no longer needed on self once it has been copied to obj, some unneeded code or data may be excluded from the final build (althouth I'm not sure whether that will happen).
Set a method value. Assigns the given function (which must be a function pointer value) to the given property of 'self'. This effectively adds a new method to the object.
The function can be an ordinary named function, or a method pointer retrieved from this object or from another object with getMethod(). Anonymous functions are NOT allowed here.
Set the superclass list. scList is a list giving the new superclasses. The superclasses must all be TadsObject objects, with one exception: the list [TadsObject] may be passed to create an object based directly on TadsObject. No other intrinsic classes can be used in the list, and objects of other types cannot be used in the list.
Adv3Lite Library Reference Manual Generated on 26/02/2025 from adv3Lite version 2.2