pub fn remove(state: &mut LuaState) -> Result<usize, LuaError>Expand description
table.remove(t, [pos]). Removes and returns t[pos] (default: the last
element, #t), shifting the tail down to close the gap.
The out-of-bounds handling is gated three ways across versions, each pinned
against its reference binary by v_remove_out_of_bounds_arg_gate_crossversion:
- 5.1 (legacy
ltablib.c): there is NOluaL_argcheck. An out-of-rangepos(outside[1, size]) silently removes nothing and returns ZERO results — never an error. - 5.2 / 5.3:
luaL_argcheck((lua_Unsigned)pos - 1u <= size, 1, ...)— the offending argument is reported as #1. - 5.4 / 5.5: the identical check, but the argument index is #2.