Next

{{API doc function {{argument|type=table|name=table}} {{argument|type=various|name=index|optional=true}} {{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
 * name = next
 * description = Gets the next index and its value of the table {{argument reference|type=table|name=table}} starting at {{argument reference|type=various|name=index}}. If {{argument reference|type=various|name=index}} is {{type|nil}}, then it returns an initial index and value. This function returns {{type|nil}} if called with the last index or {{argument reference|type=table|name=table}} is {{type|nil}}. However, the order that indices are returned are not in order, even if {{argument reference|type=table|name=table}} has numerical indices.
 * args =
 * returns = {{type|various}} index, {{type|various}} value
 * part_of = CC:Tweaked
 * api = Base globals
 * examples =
 * output_raw = program.lua:2:empty table