We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
ObjectValue is a class to implement the type of object in ReoScript. ObjectValue has a property list with key/value pairs.
When an object created in script, the ScriptRunningMachine will create an ObjectValue instance in C#.
ReoScript:
var obj = new Object(); // using Object constructor var obj = {}; // using JSON literal
C#:
ObjectValue obj = new ObjectValue();
var apple = new Object();
Set or get property value:
apple.color = 'red'; // set var a = apple.color; // get
Or create object with standard JavaScript/ECMAScript object literal syntax:
var apple = { name: 'apple', color: 'red' };
You may create objects in .Net program, the objects are also available to script.
ScriptRunningMachine srm = new ScriptRunningMachine(); ObjectValue obj = srm.CreateNewObject(); obj["name"] = "apple"; obj["color"] = "red"; srm["apple"] = obj;
Run script to output property value:
alert(apple.color); // result is red
The result is:
To add method into object in .Net program, see NativeFunctionObject.