Skip to content

luamod/mods

Repository files navigation

Mods

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 ⭐.

Documentation

Guides, module overviews, and examples live in the docs.

Installation

LuaRocks

luarocks install mods

Manual

  • 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/ to C:\Program Files\Lua\5.x\lua\mods\.

Important

Replace 5.x with your Lua version (for example, 5.4).

Modules

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.

Acknowledgments

Thanks to these Lua ecosystem projects:

  • lfs for filesystem utilities.
  • inspect for readable table representation.
  • busted for test framework support.