Returns a string representing the source code of the object.
Method of Object
Syntax
toSource()
Parameters
None
Description
The toSource method returns the following values:
- For the built-in Object object, toSource returns the following string indicating that the source code is not available:
- For instances of Object, toSource returns a string representing the source code.
- For custom objects, toSource returns the MetaScript source that defines the object as a string.
This method is usually called internally by MetaScript and not explicitly in code. You can call toSource while debugging to examine the contents of an object.
Examples
The following code defines the Dog object type and creates theDog, an object of type Dog:
Calling the toSource method of theDog displays the MetaScript source that defines the object: