In normal programming, it might not be a big issue to create tables or
closures. I love to create them :-) Especially in Lua! But I wouldn't
like ipairs(...) to always create a closure or table when working on
tables or userdata values with an __ipairs metamethod.
But are you so certain this is a real problem? Is table create such an evil in this case? I would expect that in most real-world cases the table create overhead would be small compares to the time for the entire iteration. And your from/to example doesn’t need a table anyway if you are using numeric indices, since the only value you need to keep is the “to” value.
—Tim