Never mind, apparently the iterator protocol is different from how it's described in ‘Programming in Lua’—at least in 5.1 and 5.3.