removed some builtins from the ironpython environment
This commit is contained in:
parent
cba906b9b8
commit
3a80cb18a9
1 changed files with 7 additions and 3 deletions
10
Scripting.cs
10
Scripting.cs
|
@ -1,3 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using IronPython.Hosting;
|
||||
using Microsoft.Scripting.Hosting;
|
||||
|
||||
|
@ -11,11 +12,14 @@ namespace Dungeoneer {
|
|||
// set up python engine
|
||||
Engine = Python.CreateEngine();
|
||||
Scope = Engine.CreateScope();
|
||||
dynamic Builtin = Engine.GetBuiltinModule();
|
||||
dynamic builtin = Engine.GetBuiltinModule();
|
||||
|
||||
// set up python environment
|
||||
Builtin.Remove("open");
|
||||
Scope.roll = new Func<int, int>((sides) => { return Dungeoneer.Util.Roll(sides); });
|
||||
builtin.RemoveVariable("compile");
|
||||
builtin.SetVariable("exec", (Action<string>)Run);
|
||||
builtin.RemoveVariable("open");
|
||||
|
||||
Scope.roll = (Func<int, int>)Dungeoneer.Util.Roll;
|
||||
}
|
||||
|
||||
public static void Run(string file) {
|
||||
|
|
Reference in a new issue