This project has moved. For the latest updates, please go here.


ReoScript support to access .NET object from script side directly. The following behaviors are all available:

Enable DirectAccess

By default, for safety ScriptRunningMachine disallows to access .NET types and objects from script side. To enable DirectAccess, the WorkMode of ScriptRunningMachine should be changed to true, for example:
ScriptRunningMachine srm = new ScriptRunningMachine();
srm.WorkMode |= MachineWorkMode.AllowDirectAccess;

Using DirectAccess

Assume that we have a class in .NET as below:
public class User 
  private string nickname = "no name";

  public string Nickname
    get { return nickname; }
    set { nickname = value; }

  public void Hello()
    MessageBox.Show(string.Format("Hello {0}!", nickname));

This User class contains a public property named Nickname and a public method named Hello, it is possible to access this property and call the function from script side directly.

For this demo the instance of User should be predefined in script context firstly:
srm.SetGlobalVariable("guest", new User());

An object named guest was be created and added into script, so now we can use this object:
guest.nickname = 'player1';

When this script executed, a message box will be displayed.
Hello player1!

Last edited Jan 17, 2014 at 1:29 PM by unvell, version 5