public int Set(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 3) { object arg0 = ToLua.CheckVarObject(L, 2, kclass); object arg1 = ToLua.ToVarObject(L, 3); if (arg1 != null) { arg1 = TypeChecker.ChangeType(arg1, field.FieldType); } field.SetValue(arg0, arg1); return(0); } else if (count == 6) { object arg0 = ToLua.CheckVarObject(L, 2, kclass); object arg1 = ToLua.ToVarObject(L, 3); if (arg1 != null) { arg1 = TypeChecker.ChangeType(arg1, field.FieldType); } BindingFlags arg2 = (BindingFlags)LuaDLL.luaL_checknumber(L, 4); Binder arg3 = (Binder)ToLua.CheckObject(L, 5, typeof(Binder)); CultureInfo arg4 = (CultureInfo)ToLua.CheckObject(L, 6, typeof(CultureInfo)); field.SetValue(arg0, arg1, arg2, arg3, arg4); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: LuaField.Set")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public static T[] CheckParamsObject <T>(IntPtr L, int stackPos, int count) { List <T> list = new List <T>(count); T t = default(T); Type typeFromHandle = typeof(T); while (count > 0) { object obj = ToLua.ToVarObject(L, stackPos); if (!TypeChecker.CheckType(L, typeFromHandle, stackPos)) { LuaDLL.luaL_typerror(L, stackPos, LuaMisc.GetTypeName(typeFromHandle), null); break; } T t2 = (T)((object)obj); list.Add(t2); count--; stackPos++; } return(list.ToArray()); }
static int CreateInstance(IntPtr L) { try { Type t = ToLua.CheckMonoType(L, 1); if (t == null) { LuaDLL.luaL_typerror(L, 1, "Type"); } int count = LuaDLL.lua_gettop(L); object obj = null; if (count == 1) { obj = Activator.CreateInstance(t); } else { object[] args = new object[count - 1]; for (int i = 2; i <= count; i++) { args[i - 2] = ToLua.ToVarObject(L, i); } obj = Activator.CreateInstance(t, args); } ToLua.Push(L, obj); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } return(1); }
public int Set(IntPtr L) { int result; try { int num = LuaDLL.lua_gettop(L); if (num == 3 && TypeChecker.CheckTypes(L, 2, this.kclass, typeof(object))) { object obj = ToLua.ToVarObject(L, 2); object obj2 = ToLua.ToVarObject(L, 3); obj2 = TypeChecker.ChangeType(obj2, this.field.FieldType); this.field.SetValue(obj, obj2); result = 0; } else if (num == 6 && TypeChecker.CheckTypes(L, 2, this.kclass, typeof(object), typeof(uint), typeof(Binder), typeof(CultureInfo))) { object obj3 = ToLua.ToVarObject(L, 2); object obj4 = ToLua.ToVarObject(L, 3); BindingFlags invokeAttr = (BindingFlags)LuaDLL.lua_tonumber(L, 4); Binder binder = (Binder)ToLua.ToObject(L, 5); CultureInfo culture = (CultureInfo)ToLua.ToObject(L, 6); obj4 = TypeChecker.ChangeType(obj4, this.field.FieldType); this.field.SetValue(obj3, obj4, invokeAttr, binder, culture); result = 0; } else { result = LuaDLL.luaL_throw(L, "invalid arguments to method: LuaField.Set"); } } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }
public int Set(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 4) { object arg0 = ToLua.CheckVarObject(L, 2, kclass); object arg1 = ToLua.ToVarObject(L, 3); if (arg1 != null) { arg1 = TypeChecker.ChangeType(arg1, property.PropertyType); } object[] arg2 = ToLua.CheckObjectArray(L, 4); property.SetValue(arg0, arg1, arg2); return(0); } else if (count == 7) { object arg0 = ToLua.CheckVarObject(L, 2, kclass); object arg1 = ToLua.ToVarObject(L, 3); if (arg1 != null) { arg1 = TypeChecker.ChangeType(arg1, property.PropertyType); } BindingFlags arg2 = (BindingFlags)LuaDLL.luaL_checknumber(L, 4); Binder arg3 = (Binder)ToLua.CheckObject(L, 5, typeof(Binder)); object[] arg4 = ToLua.CheckObjectArray(L, 6); CultureInfo arg5 = (CultureInfo)ToLua.CheckObject(L, 7, typeof(CultureInfo)); property.SetValue(arg0, arg1, arg2, arg3, arg4, arg5); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: LuaInterface.LuaProperty.Set")); } }
public object ToVariant(int stackPos) { return(ToLua.ToVarObject(L, stackPos)); }