Skip to content
Jing Lu edited this page May 13, 2013 · 7 revisions

CoreFeatures is an Enum to indicate what built-in features could be provided by ReoScript run-time for script executing.

Change CoreFeatures

When you create ScriptRunningMachine, you may pass the CoreFeatures enum to indicate what features are enabled. By default ReoScript provides Standard Features what same as:

ScriptRunningMachine srm = new ScriptRunningMachine(CoreFeatures.StandardFeatures);

Or if you want to enable all features:

ScriptRunningMachine srm = new ScriptRunningMachine(CoreFeatures.FullFeatures);

In same case, you may want to allow your customer to use or edit script, but you don't want customer could use alert internal function, then you can:

CoreFeatures features = CoreFeatures.StandardFeatures & ~(CoreFeatures.Alert);
ScriptRunningMachine srm = new ScriptRunningMachine(features);

Now the built-in alert function will not be provided. If the following script be executed...

srm.Run("alert('hello');");

There is a run-time exception caused.

Function is not defined: alert

Feature List

The following built-in features are available to provide for script executing, they could be enabled or disabled by CoreFeatures enum.

  • StandardFeatures

    • Alert: alert internal function
    • Eval: eval internal function
    • AsyncCalling: Async calling such as setTimeout and setInterval internal function
    • console: console internal object
    • JSON: JSON internal object
  • ExtendedFeatures

    • Linq-Like Array Extension Library
  • FullFeatures

    • StandardFeatures
    • ExtendedFeatures