I need to iterate through a table 1 index at a time each time an imp.wakeup loop executes. Searching through the Squirrel documentation it looks like the _nexti() metamethod is what I need but I can’t seem to figure the syntax out. Here is what I was thinking:
key <- null;
function loop(){
key = tbl._nexti(key)
//Do something with the key on this iteration
imp.wakeup(0.01, loop)
}
loop()
`
Another option is to keep an array of the sorted keys and loop through it - unfortunately I have a LOT of keys and am bumping up against RAM constraints…
You don’t get to call metamethods directly (for some reason), so no, there’s no such thing as a “free” iterator. Coverdriven’s answer is the best way of doing it.