The docs could use a clarification for table.for_n_of in the following cases:
What happens when it is called on table tbl that has 10 elements and n=50 - is the tbl iterated 5 times in the same call? (i.e. if I want to only ever iterate once, do I do a math.min(n, table_size(tbl)) first? )
What happens when it is called on table tbl with a from_k one element from the end and n=1000 - is the callback only called the once as it gets to the end of the table, or does for_n_of handle table wrapping?
The answers to both are manageable in the calling code, but would be nice to have answers as to what's intended in the docs. Glancing at the docs it LOOKS like the answers to both could be handled by clarifying:
"Calls callback(value, key) over n items from tbl, starting after from_k."
to
"Calls callback(value, key) over n items (or until the end of the table is reached) from tbl, starting after from_k."
Description
The docs could use a clarification for table.for_n_of in the following cases:
The answers to both are manageable in the calling code, but would be nice to have answers as to what's intended in the docs. Glancing at the docs it LOOKS like the answers to both could be handled by clarifying:
"Calls callback(value, key) over n items from tbl, starting after from_k."
to
"Calls callback(value, key) over n items (or until the end of the table is reached) from tbl, starting after from_k."
Reproduction
No response