Пример #1
0
        /// <summary>
        /// Error handler wrapping for calling of JS functions.
        /// </summary>
        public static object CallJSFunction(Jint.Native.JsFunction func, params object[] funcParameters)
        {
            try {
                return(scriptEngine.CallFunction(func, funcParameters));
            } catch (Jint.Native.JsException jsex) {
                TShockAPI.Log.ConsoleError("aliascmd js: Javascript parse error: " + jsex.Value);
            } catch (Jint.JintException jex) {
                TShockAPI.Log.ConsoleError("aliascmd js: Javascript runtime error: " + jex.Message);
            } catch (Exception ex) {
                TShockAPI.Log.ConsoleError("aliascmd js: CLR error: " + ex.ToString());
            }

            return(null);
        }
Пример #2
0
 /// <summary>
 /// Invokes an user function
 /// </summary>
 /// <param name="func"></param>              L
 /// <param name="args"></param>
 /// <returns></returns>
 public object Invoke(string func, params object[] args)
 {
     return(scriptEngine.CallFunction(func, args));
 }