A collection of micro-modules for use with Love and similar frameworks.
Overview
In general, Knife's modules seek to solve fairly low-level problems. Knife will never include modules which rely on any specific Love functionality; all modules are framework-agnostic and will run on any recent version of Lua or LuaJit, with no dependencies. Each module is isolated from the others; individual modules may be copied into a project as needed.
Some modules are similiar to existing solutions; for example knife.timer is very similar to hump.timer or (for tweens) flux. Other modules are fairly unique, like knife.convoke and knife.chain. Others occupy a sort of middle ground; knife.test and knife.system solve the same problems as existing solutions, but take a simple and flexible approach that should be refreshing.
All modules strive for a clean, minimal style. Code should be easy to follow and modify if needed. However, all modules are designed for performance, especially under LuaJit. They should perform as well as or better than other existing solutions. In some cases, clarity may be sacrificed for performance, for example when using generated code to optimize for LuaJit.
Modules
The following modules are included. More will likely be added at some point.
- knife.base - A base class for class-based OOP.
- knife.behavior - A state machine manager.
- knife.bind - Bind arguments to functions.
- knife.chain - Flatten async code with chained functions.
- knife.convoke - Flatten async code with coroutines.
- knife.event - Dispatch and handle events.
- knife.memoize - A memoization function.
- knife.serialize - Store data structures as strings.
- knife.system - An entity component system.
- knife.test - A fixture-free test framework.
- knife.timer - Create timers and tweens.
Get the code and read the docs on GitHub at airstruck/knife.