Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintain state for nested ScriptEngine Instances #101

Open
bhushan-firake opened this issue May 27, 2017 · 1 comment
Open

Maintain state for nested ScriptEngine Instances #101

bhushan-firake opened this issue May 27, 2017 · 1 comment
Labels

Comments

@bhushan-firake
Copy link

Hi,

I am executing some script. It executes a function , for instance,

executeScript1(param1, param2);

Now, in executeScript1, I call a C# function, which again creates a new instance of ScriptEngine and calls some other function, say executeScript2(param1);

So, while executing executeScript2(param1), how will I come to know in C#, that I am already executing executeScript1 or running a nested execution?

@paulbartrum
Copy link
Owner

One solution is to set a flag in executeScript1.

Something like:

public void executeScript1()
{
  RunningFlag = true;
  var engine2 = new ScriptEngine();
  engine2.Execute("executeScript2()");
  RunningFlag = false;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants