LuaInterface.LuaConstructor.Call C# (CSharp) Method

Call() public method

public Call ( IntPtr L ) : int
L System.IntPtr
return int
        public int Call(IntPtr L)
        {
            object[] args = null;
            ToLua.CheckArgsCount(L, list.Count + 1);

            if (list.Count > 0)
            {
                args = new object[list.Count];

                for (int i = 0; i < list.Count; i++)
                {
                    bool isRef = list[i].IsByRef;
                    Type t0 = isRef ? list[i].GetElementType() : list[i];
                    object o = ToLua.CheckVarObject(L, i + 2, t0);
                    args[i] = TypeChecker.ChangeType(o, t0);
                }
            }

            object ret = method.Invoke(args);
            int count = 1;
            ToLua.Push(L, ret);

            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].IsByRef)
                {
                    ++count;
                    ToLua.Push(L, args[i]);
                }
            }

            return count;
        }

Usage Example

 static int Call(IntPtr L)
 {
     try
     {
         LuaInterface.LuaConstructor obj = (LuaInterface.LuaConstructor)ToLua.CheckObject(L, 1, typeof(LuaInterface.LuaConstructor));
         return(obj.Call(L));
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }