C# Paste by Anonymous
Description: None
Page views: 255
Hide line numbers

Create new paste
Post a reply
View replies

Paste:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
ScriptRuntime runtime = Ruby.CreateRuntime();
ScriptEngine engine = Ruby.GetEngine(runtime);
ScriptScope scope = Engine.CreateScope();

string script =
@"
x = 0
for i in 1...3 do
    puts x
end
";
engine.Execute("puts 'nothing important'", scope);
//Console.WriteLine("No scope ...");
//engine.CreateScriptSourceFromString(script).Compile().Execute();

Console.WriteLine("Using scope ...");
engine.CreateScriptSourceFromString(script).Compile().Execute(scope);

Replies:
No replies posted yet

Post a Reply: