Esempio n. 1
0
 internal static LuaArguments call_event(LuaObject func, LuaArguments args)
 {
     if (func.IsFunction)
     {
         return(func.AsFunction()(args));
     }
     else
     {
         var handler = getMetamethod(func, "__call");
         if (handler.IsFunction)
         {
             var argslist = new List <LuaObject>();
             argslist.Add(func); argslist.AddRange(args);
             return(handler.AsFunction()(argslist.ToArray()));
         }
         else
         {
             throw new LuaException("Cannot call nonfunction");
         }
     }
 }