ScriptArray

Implements arrays of ScriptAny values

Constructors

this
this(ScriptAny[] values)

Takes a D array of ScriptAnys

Members

Functions

array
ScriptAny[] array(ScriptAny[] ar)

The actual array

array
ScriptAny[] array()

The actual array

assignField
ScriptAny assignField(string name, ScriptAny value)

This override allows for the length to be reassigned

length
size_t length()

Returns the length of the array

lookupField
ScriptAny lookupField(string name)

This override allows for the length field

toString
string toString()

Returns a string representation of the array, which is [] surrounding a comma separated list of elements.

Inherited Members

From ScriptObject

name
string name()

name property

getters
auto getters()

getters property

setters
auto setters()

setters property

prototype
auto prototype()

prototype property

prototype
auto prototype(ScriptObject proto)

prototype property (setter)

dictionary
auto dictionary()

This property provides direct access to the dictionary

addGetterProperty
void addGetterProperty(string propName, ScriptFunction getter)

Add a getter. Getters should be added to a constructor function's "prototype" field

addSetterProperty
void addSetterProperty(string propName, ScriptFunction setter)

Add a setter. Setters should be added to a constructor function's "prototype" field

lookupField
ScriptAny lookupField(string name)

Looks up a field through the prototype chain. Note that this does not call any getters because it is not possible to pass a Context to opIndex.

opIndex
ScriptAny opIndex(string index)

Shorthand for lookupField.

assignField
ScriptAny assignField(string name, ScriptAny value)

Assigns a field to the current object. This does not call any setters.

hasGetter
bool hasGetter(string propName)

Determines if there is a getter for a given property

hasSetter
bool hasSetter(string propName)

Determines if there is a setter for a given property

opIndexAssign
ScriptAny opIndexAssign(T value, string index)

Shorthand for assignField

getOwnPropertyDescriptor
ScriptObject getOwnPropertyDescriptor(string propName)
Undocumented in source. Be warned that the author may not have intended to support it.
nativeObject
T nativeObject()

If a native object was stored inside this ScriptObject, it can be retrieved with this function. Note that one must always check that the return value isn't null because all functions can be called with invalid "this" objects using functionName.call.

nativeObject
T nativeObject(T obj)

Native object can also be written in case of inheritance by script

toString
string toString()

Returns a string with JSON like formatting representing the object's key-value pairs as well as any nested objects. In the future this will be replaced and an explicit function call will be required to print this detailed information.

_dictionary
ScriptAny[string] _dictionary;

The dictionary of key-value pairs

_getters
ScriptFunction[string] _getters;

The lookup table for getters

_setters
ScriptFunction[string] _setters;

The lookup table for setters

Meta