//Runs a script without being tied to an instance or engine (only use for debugging) public static object QuickExecute(string expression) { if (!Application.isEditor) { Debug.LogError("Do not use 'QuickExecute' in Application: Use SnekScriptEngine instance"); } SnekScriptEngine engine = new SnekScriptEngine(); return(engine.ExecuteSnippet(expression, new SnekScope(engine.Engine.CreateScope()))); }
//Compiles a script without being tied to an instance or engine (only use for debugging) public static object QuickCompile(string expression) { if (!Application.isEditor) { Debug.LogError("Do not use 'QuickCompile' in Application: Use SnekScriptEngine instance"); } try { SnekScriptEngine engine = new SnekScriptEngine(); ScriptSource source = engine.CreateScriptSourceFromString(expression); CompiledCode command = source.Compile(); return(command); } catch (Exception e) { return(e); } }