LuaZDF - Lua Zero Dependency Functions
LuaZDF is a collection of independet functions that have zero dependencies among themselves. A function in LuaZDF can be based on lpeg, LuaFileSystem or other Lua modules but each function inside LuaZDF works on its own. That means you can copy the source code and run it in your project without the need to include LuaZDF for this functionality.
Lua itself has just a little standard library without many small utility functions that you know from other languages and envoirments. For example has Lua no trim function for strings, no trunc function for numbers and no slice function for tables in the standard library. This are not complicated functions that you are able to write yourself without much effort, find an implementation on the internet or you can include a utility library that has this functions, but each of the three possibilities has a drawback.
Simple functions that you write yourself can have flavours that you miss and not test.
A solution that you find in the internet can be outdated for the current version.
Sometimes you don’t want to add additional dependencies just to get one or two simple functions.
LuaZDF has the goal to collect and provide this kind of functions.
The LuaZDF approach to solve this problem differs to existing solution like npm. Instead of adding dependencies that need to be maintained follows LuaZDF a paradigm that is like the Go Programming Language proverb:
A little copying is better than a little dependency.
You still need to maintain your code, but not the dependencies. A small looking difference but hugh difference how your workflow will work.
LuaZDF uses the BSD 0-Clause License (0BSD) from the Toybox project.
You can explore and use existing functions as a consumer or you can add new functions as a creator.
You can explore all functions on the website.
Check the information about contribution if you want to add or modify a function.
For both use cases is it recommended to use to the command line tool lzt.
The user discussion about LuaZDF in general and the functions takes place on reddit.