Mods is a Lua utility library with predictable APIs, 💤 lazy-loaded inter-module dependencies, and support for Lua 5.1, 5.2, 5.3, 5.4, and LuaJIT.
Important
This library is not stable yet, and APIs may change between releases.
This project is inspired by Penlight (pl).
If this project helps you, consider starring the repo ⭐.
Guides, module overviews, and examples live in the docs.
luarocks install mods-
Unix (🐧 Linux / 🍎 macOS):
git clone https://github.com/luamod/mods.git cd mods mkdir -p /usr/local/share/lua/5.x/ cp -r src/mods /usr/local/share/lua/5.x/ -
🪟 Windows:
Copy all files from
src/mods/toC:\Program Files\Lua\5.x\lua\mods\.
Important
Replace 5.x with your Lua version (for example, 5.4).
| Module | Description |
|---|---|
fs |
Filesystem I/O, metadata, and filesystem path operations. |
is |
Type predicates for Lua values and filesystem path types. |
keyword |
Helpers for Lua keywords and identifiers. |
List |
A list class for creating, transforming, and querying sequences of values. |
ntpath |
Windows/NT-style path operations. |
operator |
Lua operators exposed as functions. |
path |
Cross-platform path operations with host-platform semantics. |
posixpath |
POSIX-style path operations. |
repr |
Readable string rendering for Lua values. |
runtime |
Lua runtime metadata and version compatibility flags. |
Set |
A set class for creating, combining, and querying unique values. |
str |
String operations for searching, splitting, trimming, and formatting text. |
stringcase |
String case conversion and word splitting. |
tbl |
Table operations for querying, copying, merging, and transforming tables. |
template |
String template rendering with {{...}} placeholders. |
utils |
Shared utility helpers used across the Mods library. |
validate |
Validation helpers for Lua values and filesystem path types. |
Note
We are still working on adding new modules and improving the docs.
This project is still under active development. We are also building supporting tools in parallel, including a type parser to improve autogenerated docs and a better test toolchain.
Since release v0.6.0, tests and documentation have been changing frequently.
That means contributors may occasionally run into bugs while working with the
latest commits. We also add new modules before each formal release, so the
repository may contain changes that are not available in the published version
yet. Please work from the most recent code in the repository, as the next
release will include fixes for issues discovered during this phase.
Mods will act as a core helper library for our upcoming lua projects.
Thanks to these Lua ecosystem projects: