home site:
https://github.com/starwing/luaiterluaiter is a rewritten version of luafun[1]: 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.
Some improves:
- 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
function support.
Why re-invert wheel:
- I know at least two library about this: luafun[1] and lua-itertools[2]
- 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.