Example #1
0
        public override void Action(string path, params object[] parameters)
        {
            var func = _sandbox.Get <LuaFunction>(path);

            if (func != null)
            {
                try
                {
                    func.Call(parameters);
                }
                catch (LuaException e)
                {
                    LogSystem.PrintError(e.ToString());
                }
            }
        }
Example #2
0
 public override void RaiseEvent(string eventName, params object[] parameters)
 {
     if (_eventSubscriptions.ContainsKey(eventName))
     {
         foreach (var func in _eventSubscriptions[eventName])
         {
             try
             {
                 func.Call(parameters);
             }
             catch (Exception e)
             {
                 LogSystem?.PrintError(e.Message);
             }
         }
     }
 }
Example #3
0
        public override object Func(string path, params object[] parameters)
        {
            var func = _sandbox.Get <LuaFunction>(path);

            if (func != null)
            {
                try
                {
                    var result = func.Call(parameters);
                    if (result != null && result.Length > 0)
                    {
                        return(result[0]);
                    }
                    return(null);
                }
                catch (LuaException e)
                {
                    LogSystem.PrintError("Failed to call " + path + ": " + e.ToString());
                }
            }
            return(null);
        }