Tarantool CE/EE Documentation portal logo
Support
Updated at July 17, 2026   02:08 PM

tuple_object:next()

tuple_object

next(tuple[, pos])

An analogue of the Lua next() function, but for a tuple object. When called without arguments, tuple:next() returns the first field from a tuple. Otherwise, it returns the field next to the indicated position.

However tuple:next() is not really efficient, and it is better to use tuple:pairs()/ipairs().

Returns

field number and field value

Return type

number and field type

tarantool> tuple = box.tuple.new({5, 4, 3, 2, 0})---...tarantool> tuple:next()---- 1- 5...tarantool> tuple:next(1)---- 2- 4...tarantool> ctx, field = tuple:next()---...tarantool> while field do         > print(field)         > ctx, field = tuple:next(ctx)         > end54320---...