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 IronPython.Hosting;
|
||||||
using Microsoft.Scripting.Hosting;
|
using Microsoft.Scripting.Hosting;
|
||||||
|
|
||||||
|
@ -11,11 +12,14 @@ namespace Dungeoneer {
|
||||||
// set up python engine
|
// set up python engine
|
||||||
Engine = Python.CreateEngine();
|
Engine = Python.CreateEngine();
|
||||||
Scope = Engine.CreateScope();
|
Scope = Engine.CreateScope();
|
||||||
dynamic Builtin = Engine.GetBuiltinModule();
|
dynamic builtin = Engine.GetBuiltinModule();
|
||||||
|
|
||||||
// set up python environment
|
// set up python environment
|
||||||
Builtin.Remove("open");
|
builtin.RemoveVariable("compile");
|
||||||
Scope.roll = new Func<int, int>((sides) => { return Dungeoneer.Util.Roll(sides); });
|
builtin.SetVariable("exec", (Action<string>)Run);
|
||||||
|
builtin.RemoveVariable("open");
|
||||||
|
|
||||||
|
Scope.roll = (Func<int, int>)Dungeoneer.Util.Roll;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Run(string file) {
|
public static void Run(string file) {
|
||||||
|
|
Reference in a new issue