Difference between revisions of "Next"

From ComputerCraft
Jump to navigation Jump to search
(Created page with "{{API doc function | name = next | description = Gets the next index and its value of the table {{argument reference|type=table|name=table}} starting at {{argument reference|t...")
(No difference)

Revision as of 07:59, 10 September 2019

{{API doc function | name = next | description = Gets the next index and its value of the table table starting at index. If index is nil, then it returns an initial index and value. This function returns nil if called with the last index or table is nil. However, the order that indices are returned are not in order, even if table has numerical indices. | args =

  • table : table
  • index? : various
  • | returns = various index, various value | part_of = CC:Tweaked | api = Base globals | examples = {{API doc example | name = Check if a table is empty | description = Errors if table is empty, or prints the table's contents. | code = local t1 = {} if next(t1) then print(textutils.serialize(t1)) else error("empty table", 2) end | output_raw = program.lua:2:empty table