private static object API_Eval_CS(string spec, object param)
        {
            var code = param?.ToString();

            if (string.IsNullOrWhiteSpace(code))
            {
                return(new ArgumentNullException(nameof(param)));
            }
            if (ScriptingLibrary.LoadLibraries() is Exception err)
            {
                return(err);
            }
            Info("API> {0}", code);
            var mod = (Api("api_stack mod") as string[])?.FirstOrDefault(e => e != "Zy.cSharp") ?? "API";

            return(ScriptingEngine.Eval(mod, code));
        }
        private static void EvalToConsole(IConsole console, string code)
        {
            if (ScriptingLibrary.LoadLibraries() is Exception err)
            {
                console.Write(FormatException(err));
                return;
            }
            var result = ScriptingEngine.Eval("Console", code);

            if (result == null && code.IndexOf('-') > 0)
            {
                return;                                           // Ignore "null" result from assignment statement.
            }
            if (result is Exception ex)
            {
                result = FormatException(ex) + ex.StackTrace;
            }
            if (Api("console.write", result) is bool write && write)
            {
                return;
            }
 public static object ActionMod(string modId, Dictionary <string, object> action)
 {
     try {
         object value = null;
         if (action?.TryGetValue("eval", out value) != true || !(value is string code))
         {
             return(false);
         }
         if (LoadLibraries() is Exception lib_err)
         {
             return(lib_err);
         }
         Info("Action> {0}", code);
         var result = ScriptingEngine.Eval(modId, code);
         if (result is Exception ev_err)
         {
             return(ev_err);
         }
         Verbo("Action< {0}", result);
         return(true);
     } catch (Exception ex) { return(ex); }
 }