pub fn insert(state: &mut LuaState) -> Result<usize, LuaError>Expand description
table.insert(t, [pos,] v). With two args, appends v at border+1. With
three, inserts v at pos (1 <= pos <= border+1) after shifting the tail
up by one; any other arity raises “wrong number of arguments to ‘insert’”.
The bounds check uses a wrapping unsigned subtract so pos <= 0 is rejected
alongside pos > border+1. Note border here is #t, which honors a
__len metamethod on 5.2+ and uses the primitive length on 5.1.