D2BS
Public Member Functions

Sandbox Class Reference

A separate context to run scripts in. More...

List of all members.

Public Member Functions

 Sandbox ()
 Create a Sandbox.
Object evaluate (String code)
 Evaluate the code passed in and return the result.
Object include (String file)
 Include a file from ScriptPath\libs\file.
bool isInclude (String file)
 Determine whether a file has been included yet or not.
void clearScope ()
 Clear the scope of the Sandbox's global object.

Detailed Description

A separate context to run scripts in.


Constructor & Destructor Documentation

Sandbox::Sandbox ( )

Create a Sandbox.

This creates a separate context to run things in.


Member Function Documentation

void Sandbox::clearScope ( )

Clear the scope of the Sandbox's global object.

Todo:
Clarify what this means (i.e. post-conditions).
Object Sandbox::evaluate ( String  code)

Evaluate the code passed in and return the result.

Parameters:
codeThe code to run, literally JavaScript code to run.
Returns:
The result of the last expression statement.
Object Sandbox::include ( String  file)

Include a file from ScriptPath\libs\file.

Parameters:
fileThe filename relative to ScriptPath\libs to include.
Returns:
The result of the last expression statement.
bool Sandbox::isInclude ( String  file)

Determine whether a file has been included yet or not.

Parameters:
fileThe filename relative to ScriptPath\libs to include.
Returns:
Whether or not the file has been included.