Returns an iterator function for a table. Return values are such that the construction

  for k,v in pairs(t)
    -- body
  end

will iterate over all key/value pairs in the table.


See also Lua library functions.

Signature:

iterator, t, index = pairs(t)

Arguments:

  • t - A table (table)

Returns:

  • iterator - The next() function (function)
  • t - The table provided (table)
  • index - Always nil; used internally (number)
This function is defined in the Lua standard libraries