static int Reverse(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); Type argType = null; object obj = ToLua.CheckGenericObject(L, 1, typeof(List <>), out argType); if (count == 1) { LuaMethodCache.CallMethod("Reverse", obj); return(0); } else if (count == 3) { int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); LuaMethodCache.CallMethod("Reverse", obj, arg0, arg1); return(0); } else { return(LuaDLL.luaL_throw(L, string.Format("invalid arguments to method: List<{0}>.LastIndexOf", LuaMisc.GetTypeName(argType)))); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int FindAll(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Type argType = null; Delegate arg0 = null; object obj = ToLua.CheckGenericObject(L, 1, typeof(List <>), out argType); LuaTypes funcType2 = LuaDLL.lua_type(L, 2); if (funcType2 != LuaTypes.LUA_TFUNCTION) { arg0 = (Delegate)ToLua.CheckObject(L, 2, typeof(System.Predicate <>).MakeGenericType(argType)); } else { LuaFunction func = ToLua.ToLuaFunction(L, 2); arg0 = DelegateFactory.CreateDelegate(typeof(System.Predicate <>).MakeGenericType(argType), func); } object o = LuaMethodCache.CallMethod("FindAll", obj, arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
private static int LastIndexOf(IntPtr L) { int result; try { int num = LuaDLL.lua_gettop(L); Type type = null; object obj = ToLua.CheckGenericObject(L, 1, typeof(List <>), out type); if (num == 2 && TypeChecker.CheckTypes(L, 2, type)) { object obj2 = ToLua.ToVarObject(L, 2, type); int n = (int)LuaMethodCache.CallMethod("LastIndexOf", obj, new object[] { obj2 }); LuaDLL.lua_pushinteger(L, n); result = 1; } else if (num == 3 && TypeChecker.CheckTypes(L, 2, type, typeof(int))) { object obj3 = ToLua.ToVarObject(L, 2, type); int num2 = (int)LuaDLL.lua_tonumber(L, 3); int n2 = (int)LuaMethodCache.CallMethod("LastIndexOf", obj, new object[] { obj3, num2 }); LuaDLL.lua_pushinteger(L, n2); result = 1; } else if (num == 4 && TypeChecker.CheckTypes(L, 2, type, typeof(int), typeof(int))) { object obj4 = ToLua.ToVarObject(L, 2, type); int num3 = (int)LuaDLL.lua_tonumber(L, 3); int num4 = (int)LuaDLL.lua_tonumber(L, 4); int n3 = (int)LuaMethodCache.CallMethod("LastIndexOf", obj, new object[] { obj4, num3, num4 }); LuaDLL.lua_pushinteger(L, n3); result = 1; } else { result = LuaDLL.luaL_throw(L, string.Format("invalid arguments to method: List<{0}>.LastIndexOf", LuaMisc.GetTypeName(type))); } } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }
private static int CopyTo(IntPtr L) { int result; try { int num = LuaDLL.lua_gettop(L); Type type = null; object obj = ToLua.CheckGenericObject(L, 1, typeof(List <>), out type); if (num == 2 && TypeChecker.CheckTypes(L, 2, type.MakeArrayType())) { object obj2 = ToLua.ToObject(L, 2); LuaMethodCache.CallMethod("CopyTo", obj, new object[] { obj2 }); result = 0; } else if (num == 3 && TypeChecker.CheckTypes(L, 2, type.MakeArrayType(), typeof(int))) { object obj3 = ToLua.ToObject(L, 2); int num2 = (int)LuaDLL.lua_tonumber(L, 3); LuaMethodCache.CallMethod("CopyTo", obj, new object[] { obj3, num2 }); result = 0; } else if (num == 5 && TypeChecker.CheckTypes(L, 2, typeof(int), type.MakeArrayType(), typeof(int), typeof(int))) { int num3 = (int)LuaDLL.lua_tonumber(L, 2); object obj4 = ToLua.ToObject(L, 3); int num4 = (int)LuaDLL.lua_tonumber(L, 4); int num5 = (int)LuaDLL.lua_tonumber(L, 5); LuaMethodCache.CallMethod("CopyTo", obj, new object[] { num3, obj4, num4, num5 }); result = 0; } else { result = LuaDLL.luaL_throw(L, string.Format("invalid arguments to method: List<{0}>.CopyTo", LuaMisc.GetTypeName(type))); } } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }
static int Exists(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Type argType = null; object obj = ToLua.CheckGenericObject(L, 1, typeof(List <>), out argType); Delegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate <>).MakeGenericType(argType), L, 2); bool o = (bool)LuaMethodCache.CallMethod("Exists", obj, arg0); LuaDLL.lua_pushboolean(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int FindAll(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); Type argType = null; object obj = ToLua.CheckGenericObject(L, 1, typeof(List <>), out argType); Delegate arg0 = ToLua.CheckDelegate(typeof(System.Predicate <>).MakeGenericType(argType), L, 2); object o = LuaMethodCache.CallMethod("FindAll", obj, arg0); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int IndexOf(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); Type argType = null; IList obj = (IList)ToLua.CheckGenericObject(L, 1, TypeOfList, out argType); if (count == 2) { object arg0 = ToLua.CheckVarObject(L, 2, argType); //int o = (int)LuaMethodCache.CallMethod("IndexOf", obj, arg0); int o = obj.IndexOf(arg0); LuaDLL.lua_pushinteger(L, o); return(1); } else if (count == 3) { object arg0 = ToLua.CheckVarObject(L, 2, argType); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); int o = (int)LuaMethodCache.CallMethod("IndexOf", obj, arg0, arg1); LuaDLL.lua_pushinteger(L, o); return(1); } else if (count == 4) { object arg0 = ToLua.CheckVarObject(L, 2, argType); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); int o = (int)LuaMethodCache.CallMethod("IndexOf", obj, arg0, arg1, arg2); LuaDLL.lua_pushinteger(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, string.Format("invalid arguments to method: List<{0}>.IndexOf", LuaMisc.GetTypeName(argType)))); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int BinarySearch(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); Type argType = null; object obj = ToLua.CheckGenericObject(L, 1, typeof(List <>), out argType); if (count == 2) { object arg0 = ToLua.CheckVarObject(L, 2, argType); int o = (int)LuaMethodCache.CallMethod("BinarySearch", obj, arg0); LuaDLL.lua_pushinteger(L, o); return(1); } else if (count == 3) { object arg0 = ToLua.CheckVarObject(L, 2, argType); object arg1 = ToLua.CheckObject(L, 3, typeof(IComparer <>).MakeGenericType(argType)); int o = (int)LuaMethodCache.CallMethod("BinarySearch", obj, arg0, arg1); LuaDLL.lua_pushinteger(L, o); return(1); } else if (count == 5) { int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); object arg2 = ToLua.CheckVarObject(L, 4, argType); object arg3 = ToLua.CheckObject(L, 5, typeof(IComparer <>).MakeGenericType(argType)); int o = (int)LuaMethodCache.CallMethod("BinarySearch", obj, arg0, arg1, arg2, arg3); LuaDLL.lua_pushinteger(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, string.Format("invalid arguments to method: List<{0}>.BinarySearch", LuaMisc.GetTypeName(argType)))); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int Sort(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); Type argType = null; object obj = ToLua.CheckGenericObject(L, 1, typeof(List <>), out argType); if (count == 1) { LuaMethodCache.CallMethod("Sort", obj); return(0); } else if (count == 2 && TypeChecker.CheckTypes(L, 2, typeof(System.Comparison <>).MakeGenericType(argType))) { Delegate arg0 = (Delegate)ToLua.ToObject(L, 2); LuaMethodCache.CallMethod("Sort", obj, arg0); return(0); } else if (count == 2 && TypeChecker.CheckTypes(L, 2, typeof(IComparer <>).MakeGenericType(argType))) { object arg0 = ToLua.ToObject(L, 2); LuaMethodCache.CallMethod("Sort", obj, arg0); return(0); } else if (count == 4) { int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); object arg2 = ToLua.CheckObject(L, 4, typeof(IComparer <>).MakeGenericType(argType)); LuaMethodCache.CallMethod("Sort", obj, arg0, arg1, arg2); return(0); } else { return(LuaDLL.luaL_throw(L, string.Format("invalid arguments to method: List<{0}>.LastIndexOf", LuaMisc.GetTypeName(argType)))); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int CopyTo(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); Type argType = null; ICollection obj = (ICollection)ToLua.CheckGenericObject(L, 1, TypeOfList, out argType); if (count == 2) { object arg0 = ToLua.CheckObject(L, 2, argType.MakeArrayType()); obj.CopyTo((Array)arg0, 0); //LuaMethodCache.CallMethod("CopyTo", obj, arg0); return(0); } else if (count == 3) { object arg0 = ToLua.CheckObject(L, 2, argType.MakeArrayType()); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); obj.CopyTo((Array)arg0, arg1); //LuaMethodCache.CallMethod("CopyTo", obj, arg0, arg1); return(0); } else if (count == 5) { int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); object arg1 = ToLua.CheckObject(L, 3, argType.MakeArrayType()); int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); int arg3 = (int)LuaDLL.luaL_checknumber(L, 5); LuaMethodCache.CallMethod("CopyTo", obj, arg0, arg1, arg2, arg3); return(0); } else { return(LuaDLL.luaL_throw(L, string.Format("invalid arguments to method: List<{0}>.CopyTo", LuaMisc.GetTypeName(argType)))); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int LastIndexOf(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); Type argType = null; object obj = ToLua.CheckGenericObject(L, 1, typeof(List <>), out argType); if (count == 2 && TypeChecker.CheckTypes(L, 2, argType)) { object arg0 = ToLua.ToVarObject(L, 2, argType); int o = (int)LuaMethodCache.CallMethod("LastIndexOf", obj, arg0); LuaDLL.lua_pushinteger(L, o); return(1); } else if (count == 3 && TypeChecker.CheckTypes(L, 2, argType, typeof(int))) { object arg0 = ToLua.ToVarObject(L, 2, argType); int arg1 = (int)LuaDLL.lua_tonumber(L, 3); int o = (int)LuaMethodCache.CallMethod("LastIndexOf", obj, arg0, arg1); LuaDLL.lua_pushinteger(L, o); return(1); } else if (count == 4 && TypeChecker.CheckTypes(L, 2, argType, typeof(int), typeof(int))) { object arg0 = ToLua.ToVarObject(L, 2, argType); int arg1 = (int)LuaDLL.lua_tonumber(L, 3); int arg2 = (int)LuaDLL.lua_tonumber(L, 4); int o = (int)LuaMethodCache.CallMethod("LastIndexOf", obj, arg0, arg1, arg2); LuaDLL.lua_pushinteger(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, string.Format("invalid arguments to method: List<{0}>.LastIndexOf", LuaMisc.GetTypeName(argType)))); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int FindLastIndex(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); Type argType = null; object obj = ToLua.CheckGenericObject(L, 1, typeof(List <>), out argType); if (count == 2) { Delegate arg0 = (Delegate)ToLua.CheckObject(L, 2, typeof(System.Predicate <>).MakeGenericType(argType)); int o = (int)LuaMethodCache.CallMethod("FindLastIndex", obj, arg0); LuaDLL.lua_pushinteger(L, o); return(1); } else if (count == 3) { int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); Delegate arg1 = (Delegate)ToLua.CheckObject(L, 3, typeof(System.Predicate <>).MakeGenericType(argType)); int o = (int)LuaMethodCache.CallMethod("FindLastIndex", obj, arg0, arg1); LuaDLL.lua_pushinteger(L, o); return(1); } else if (count == 4) { int arg0 = (int)LuaDLL.luaL_checknumber(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); Delegate arg2 = (Delegate)ToLua.CheckObject(L, 4, typeof(System.Predicate <>).MakeGenericType(argType)); int o = (int)LuaMethodCache.CallMethod("FindLastIndex", obj, arg0, arg1, arg2); LuaDLL.lua_pushinteger(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, string.Format("invalid arguments to method: List<{0}>.FindLastIndex", LuaMisc.GetTypeName(argType)))); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int CopyTo(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); Type argType = null; object obj = ToLua.CheckGenericObject(L, 1, typeof(List <>), out argType); if (count == 2 && TypeChecker.CheckTypes(L, 2, argType.MakeArrayType())) { object arg0 = ToLua.ToObject(L, 2); LuaMethodCache.CallMethod("CopyTo", obj, arg0); return(0); } else if (count == 3 && TypeChecker.CheckTypes(L, 2, argType.MakeArrayType(), typeof(int))) { object arg0 = ToLua.ToObject(L, 2); int arg1 = (int)LuaDLL.lua_tonumber(L, 3); LuaMethodCache.CallMethod("CopyTo", obj, arg0, arg1); return(0); } else if (count == 5 && TypeChecker.CheckTypes(L, 2, typeof(int), argType.MakeArrayType(), typeof(int), typeof(int))) { int arg0 = (int)LuaDLL.lua_tonumber(L, 2); object arg1 = ToLua.ToObject(L, 3); int arg2 = (int)LuaDLL.lua_tonumber(L, 4); int arg3 = (int)LuaDLL.lua_tonumber(L, 5); LuaMethodCache.CallMethod("CopyTo", obj, arg0, arg1, arg2, arg3); return(0); } else { return(LuaDLL.luaL_throw(L, string.Format("invalid arguments to method: List<{0}>.CopyTo", LuaMisc.GetTypeName(argType)))); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
private static int FindAll(IntPtr L) { int result; try { ToLua.CheckArgsCount(L, 2); Type type = null; object obj = ToLua.CheckGenericObject(L, 1, typeof(List <>), out type); LuaTypes luaTypes = LuaDLL.lua_type(L, 2); Delegate @delegate; if (luaTypes != LuaTypes.LUA_TFUNCTION) { @delegate = (Delegate)ToLua.CheckObject(L, 2, typeof(Predicate <>).MakeGenericType(new Type[] { type })); } else { LuaFunction func = ToLua.ToLuaFunction(L, 2); @delegate = DelegateFactory.CreateDelegate(typeof(Predicate <>).MakeGenericType(new Type[] { type }), func); } object obj2 = LuaMethodCache.CallMethod("FindAll", obj, new object[] { @delegate }); ToLua.Push(L, obj2); result = 1; } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }
private static int Reverse(IntPtr L) { int result; try { int num = LuaDLL.lua_gettop(L); Type t = null; object obj = ToLua.CheckGenericObject(L, 1, typeof(List <>), out t); if (num == 1) { LuaMethodCache.CallMethod("Reverse", obj, new object[0]); result = 0; } else if (num == 3 && TypeChecker.CheckTypes(L, 2, typeof(int), typeof(int))) { int num2 = (int)LuaDLL.lua_tonumber(L, 2); int num3 = (int)LuaDLL.lua_tonumber(L, 3); LuaMethodCache.CallMethod("Reverse", obj, new object[] { num2, num3 }); result = 0; } else { result = LuaDLL.luaL_throw(L, string.Format("invalid arguments to method: List<{0}>.LastIndexOf", LuaMisc.GetTypeName(t))); } } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }
private static int BinarySearch(IntPtr L) { int result; try { int num = LuaDLL.lua_gettop(L); Type type = null; object obj = ToLua.CheckGenericObject(L, 1, typeof(List <>), out type); if (num == 2 && TypeChecker.CheckTypes(L, 2, type)) { object obj2 = ToLua.ToVarObject(L, 2, type); int n = (int)LuaMethodCache.CallMethod("BinarySearch", obj, new object[] { obj2 }); LuaDLL.lua_pushinteger(L, n); result = 1; } else if (num == 3 && TypeChecker.CheckTypes(L, 2, type, typeof(IComparer <>).MakeGenericType(new Type[] { type }))) { object obj3 = ToLua.ToVarObject(L, 2, type); object obj4 = ToLua.ToObject(L, 3); int n2 = (int)LuaMethodCache.CallMethod("BinarySearch", obj, new object[] { obj3, obj4 }); LuaDLL.lua_pushinteger(L, n2); result = 1; } else if (num == 5 && TypeChecker.CheckTypes(L, 2, typeof(int), typeof(int), type, typeof(IComparer <>).MakeGenericType(new Type[] { type }))) { int num2 = (int)LuaDLL.lua_tonumber(L, 2); int num3 = (int)LuaDLL.lua_tonumber(L, 3); object obj5 = ToLua.ToVarObject(L, 4, type); object obj6 = ToLua.ToObject(L, 5); int n3 = (int)LuaMethodCache.CallMethod("BinarySearch", obj, new object[] { num2, num3, obj5, obj6 }); LuaDLL.lua_pushinteger(L, n3); result = 1; } else { result = LuaDLL.luaL_throw(L, string.Format("invalid arguments to method: List<{0}>.BinarySearch", LuaMisc.GetTypeName(type))); } } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }
private static int FindLastIndex(IntPtr L) { int result; try { int num = LuaDLL.lua_gettop(L); Type type = null; object obj = ToLua.CheckGenericObject(L, 1, typeof(List <>), out type); if (num == 2 && TypeChecker.CheckTypes(L, 2, typeof(Predicate <>).MakeGenericType(new Type[] { type }))) { Delegate @delegate = (Delegate)ToLua.ToObject(L, 2); int n = (int)LuaMethodCache.CallMethod("FindLastIndex", obj, new object[] { @delegate }); LuaDLL.lua_pushinteger(L, n); result = 1; } else if (num == 3 && TypeChecker.CheckTypes(L, 2, typeof(int), typeof(Predicate <>).MakeGenericType(new Type[] { type }))) { int num2 = (int)LuaDLL.lua_tonumber(L, 2); Delegate delegate2 = (Delegate)ToLua.ToObject(L, 3); int n2 = (int)LuaMethodCache.CallMethod("FindLastIndex", obj, new object[] { num2, delegate2 }); LuaDLL.lua_pushinteger(L, n2); result = 1; } else if (num == 4 && TypeChecker.CheckTypes(L, 2, typeof(int), typeof(int), typeof(Predicate <int>))) { int num3 = (int)LuaDLL.lua_tonumber(L, 2); int num4 = (int)LuaDLL.lua_tonumber(L, 3); Delegate delegate3 = (Delegate)ToLua.ToObject(L, 4); int n3 = (int)LuaMethodCache.CallMethod("FindLastIndex", obj, new object[] { num3, num4, delegate3 }); LuaDLL.lua_pushinteger(L, n3); result = 1; } else { result = LuaDLL.luaL_throw(L, string.Format("invalid arguments to method: List<{0}>.FindLastIndex", LuaMisc.GetTypeName(type))); } } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }
private static int Sort(IntPtr L) { int result; try { int num = LuaDLL.lua_gettop(L); Type type = null; object obj = ToLua.CheckGenericObject(L, 1, typeof(List <>), out type); if (num == 1) { LuaMethodCache.CallMethod("Sort", obj, new object[0]); result = 0; } else if (num == 2 && TypeChecker.CheckTypes(L, 2, typeof(Comparison <>).MakeGenericType(new Type[] { type }))) { Delegate @delegate = (Delegate)ToLua.ToObject(L, 2); LuaMethodCache.CallMethod("Sort", obj, new object[] { @delegate }); result = 0; } else if (num == 2 && TypeChecker.CheckTypes(L, 2, typeof(IComparer <>).MakeGenericType(new Type[] { type }))) { object obj2 = ToLua.ToObject(L, 2); LuaMethodCache.CallMethod("Sort", obj, new object[] { obj2 }); result = 0; } else if (num == 4 && TypeChecker.CheckTypes(L, 2, typeof(int), typeof(int), typeof(IComparer <>).MakeGenericType(new Type[] { type }))) { int num2 = (int)LuaDLL.lua_tonumber(L, 2); int num3 = (int)LuaDLL.lua_tonumber(L, 3); object obj3 = ToLua.ToObject(L, 4); LuaMethodCache.CallMethod("Sort", obj, new object[] { num2, num3, obj3 }); result = 0; } else { result = LuaDLL.luaL_throw(L, string.Format("invalid arguments to method: List<{0}>.LastIndexOf", LuaMisc.GetTypeName(type))); } } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }