home site: https://github.com/starwing/luaiter
luaiter is a rewritten version of luafun: a high-performance
functional programming library for Lua designed with LuaJIT's trace
compiler in mind. luaiter focus plain Lua performance improve and
follows the standard Lua iteration protocol.
- avoid any memory allocation when iteration.
- use standard iteration protocol.
- support Lua 5.3 bit operators.
- add more useful functions like `scan` and `flatmap`.
- add a powerful `selector` interface for quick-and-dirty lambda
Why re-invert wheel:
- I know at least two library about this: luafun and lua-itertools
- while lua-itertools use coroutine, too heavily for me.
- luafun mainly optimize for LuaJIT, but I mainly use plain Lua.
- luafun may allocate memory when iterating, but I need use it in game.
- luafun has a custom iterator usage, can not use together with e.g. io.lines()
luaiter could be used in Unity/cocos2d-x games, and I could use it write code tools.