LÖVE tools
LÖVE tools, or love2d-tools
, is a series of LÖVE utilities, inspired by batteries.
Installation
- Clone the repository
git clone https://github.com/Nykenik24/love2d-tools.git
Or add it as a submodule (recommended)
git submodule add https://github.com/Nykenik24/love2d-tools.git path/to/library
You can also download the latest release, but if you want the latest modules and features, i recomend cloning or adding as a submodule. I don’t make a release every time i add a module, only when i make patches or release various modules.
- Require the library in your
main.lua
or the file where you load libraries.
Tools = require("love2d-tools.lib")
-- or you can require every module individually
Class = require("love2d-tools.modules.class")
- Now you can use the library, all the modules are documented.
Tools = require("love2d-tools.lib")
ClassTool = Tools.class
DebugTool = Tools.debug --note that lua already has a standard debug library, so don't name the module "debug".
TimerTool = Tools.timer
MyClass = ClassTool {
smth = "Hello World!",
other_thing = 5
}
MyClass_obj = MyClass:new()
MyTimer = Timer(5) --5 is the duration of the timer
MyTimer:Update()
MyTimer.OnEnd = function(self) --will be called every time the timer ends
DebugTool.Equal(MyClass_obj.other_thing, 5)
end
Modules
These are the modules it comes with:
- OOP (
class
): Class system, has: objects (obviously), subclasses, “merging” and “cloning” classes; etc. - Timer (
timer
): Allows to create timers, has an automaticupdate
method and anOnEnd
method that you can customize. - Input (
input
): Mouse/keyboard input helper. - MessageBus (
messagebus
): Message bus that handles publishers and suscribers. Made by zalanwastaken. - StateMachine (
state
): State machine that handles: info, an update function, etc. - Easing (
easing
): Easing helper to make smoother movement or ease values. Licenses of used resources in the licenses directory. - Vector2 (
vec2
): Simple vec2 system. - Mathx (
math
): Useful math functions not present inlua
andlove2d
. - Tablex (
table
): Table handling extension. Category: Lua extensions. - Logger (
logger
): Logging module that uses a separate thread for minimum performance impact. Made by zalanwastaken. - Debug (
debug
): Basic debug utility with assert functions. - Database (
database
): Database-like data managing system. Made by zalanwastaken. - Set (
set
): Simple set implementation.
More
To read about contributing, the roadmap, etc., visit the GitHub repository