Talk:Lua Programming/Tables

Missing word
In the section Creating iterators a word is missing: "Along with the loop variables, the transformation function is also passed in a state value which will remain constant throughout the loop. The missing word can be used, for example, to maintain a reference to the data structure, file handle or resource the transformation function is iterating over." I think it is state, but I am not sure because of the "for example". I can not think of anything else than maintaining a reference. Or is the "for example" at the wrong place and should relate to "data structure, file handle or resource"? --Johnwayne1986 (discuss • contribs) 09:45, 7 August 2015 (UTC)
 * I can see the state value being used to pass an arbitrary value to the iterator function. For example, if the iterator's purpose was to return each value in an array (an array in the global environment, say, not one passed to the iterator by the loop) starting at a given index, and the current index was not desired in the loop variables for whatever reason, then the state value could be used to give the iterator the index to start at. In any case the missing word is definitely state value. --Mark Otaris (discuss • contribs) 08:23, 21 August 2015 (UTC)