Skip to content

luamod/mods

Repository files navigation

Mods

Mods is a pure 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
is Type predicates for Lua values and filesystem path types.
keyword Lua keyword helpers.
List Python-style list helpers for mapping, filtering, and slicing.
operator Operator helpers as functions.
repr Render any Lua value as a readable string.
runtime Exposes Lua runtime metadata and version compatibility flags.
Set Set operations and helpers for unique values.
str String utility helpers modeled after Python's str.
stringcase String case conversion helpers.
tbl Utility functions for working with Lua tables.
template Interpolate string placeholders of the form {{...}}.
utils Small shared utility helpers used by modules in this library.
validate Validation checks for 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.