public static int LuaNewIndex(IntPtr ptr) { try { Array a = (Array)CheckSelf(ptr); int i; CheckType(ptr, 2, out i); LuaObject.Assert(i > 0, "index base 1"); object o = CheckVar(ptr, 3); Type et = a.GetType().GetElementType(); a.SetValue(LuaObject.ChangeType(o, et), i - 1); return(LuaObject.Ok(ptr)); } catch (Exception e) { return(Error(ptr, e)); } }