From 3a80cb18a99a2796f936df676a1a040851aeee51 Mon Sep 17 00:00:00 2001 From: Valerie Date: Thu, 28 Mar 2024 23:30:10 -0400 Subject: [PATCH] removed some builtins from the ironpython environment --- Scripting.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Scripting.cs b/Scripting.cs index ed09c06..361afda 100644 --- a/Scripting.cs +++ b/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((sides) => { return Dungeoneer.Util.Roll(sides); }); + builtin.RemoveVariable("compile"); + builtin.SetVariable("exec", (Action)Run); + builtin.RemoveVariable("open"); + + Scope.roll = (Func)Dungeoneer.Util.Roll; } public static void Run(string file) {