Constructs a new ScriptAny based on the value given.
Enumeration of what type is held by a ScriptAny. Note that a function, array, or string can be used as an object.
Add a get method to an object
Add a set method to an object
Attempt to assign a field of a complex object. This can be used to assign array indexes if the index is a number.
Overload to ignore the bool
Converts a stored value back into a D value if it is valid, otherwise throws an exception.
Returns true if the value stored is a valid integer, but not a floating point number.
Returns true if the type is NULL or if it an object or function whose stored value is null
Returns true if the value stored is a numerical type or anything that can be converted into a valid number such as boolean, or even null, which gets converted to 0.
This should always be used instead of checking type==OBJECT because ScriptFunction, ScriptArray, and ScriptString are valid subclasses of ScriptObject.
Returns true if the type is UNDEFINED.
Depending on the type of index, if it is a string it accesses a field of the object, otherwise if it is numerical, attempts to access an index of an array object.
Overload to ignore the bool
Assigns a value.
Implements binary math operations between two ScriptAnys and returns a ScriptAny. For certain operations that make no sense the result will be NaN or UNDEFINED
opCast will now use toValue
The comparison operations. Note that this only returns a meaningful, usable value if the values are similar enough in type to be compared. For the purpose of the scripting language, invalid comparisons do not throw an exception but they return a meaningless incorrect result.
Tests for equality by casting similar types to the same type and comparing values. If the types are too different to do this, the result is false.
Shorthand to access fields of the complex object types
Shorthand to assign fields of the complex object types
Defines unary math operations for a ScriptAny.
A method so that undefined || 22 results in 22.
This implements the '===' and '!==' operators. Objects must be exactly the same in type and value. This operator should not be used on numerical primitives because true === 1 will return false.
This allows ScriptAny to be used as a key index in a table, however the scripting language currently only uses strings.
Shorthand for returning nativeObject from casting this to ScriptObject
Returns a string representation of the stored value
Similar to checkValue except if the type is invalid and doesn't match the template type, a sane default value such as 0 or null is returned instead of throwing an exception.
Returns the read-only type property. This should always be checked before using the toValue or checkValue template to retrieve the stored D value.
For use with the scripting language's typeof operator
This should always be used to return an undefined value.
This variant holds primitive values as well as ScriptObject types.