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

tuple_object:pairs(), tuple_object:ipairs()

tuple_object

pairs() ipairs()

In Lua, lua-table-value:pairs() is a method which returns: function, lua-table-value, nil. Tarantool has extended this so that tuple-value:pairs() returns: function, tuple-value, nil. It is useful for Lua iterators, because Lua iterators traverse a value's components until an end marker is reached.

tuple_object:ipairs() is the same as pairs(), because tuple fields are always integers.

Returns

function, tuple-value, nil

Return type

function, lua-value, nil

In the following example, a tuple named t is created and then all its fields are selected using a Lua for-end loop.

tarantool> t = box.tuple.new{'Fld#1', 'Fld#2', 'Fld#3', 'Fld#4', 'Fld#5'}---...tarantool> tmp = ''---...tarantool> for k, v in t:pairs() do         >   tmp = tmp .. v         > end---...tarantool> tmp---- Fld#1Fld#2Fld#3Fld#4Fld#5...