Introduction
Browse docs
lde is a small and fast package manager, runtime, test runner and compiler for lua projects.
Why lde?
- It already works with your projects. Just run
ldx rocks:tlandlde add rocks:luasocket - You’re on windows and want lua on your system without setting up a full C toolchain.
- It works with your language.
lde ./foo.tlandlde ./foo.moonjust work. - You want to ship a single binary to run your code to users without them needing lua.
Getting Started
Run lde new to create a new project. You’ll be presented with an interactive tui.
~> lde new
? Project type
> blank A basic hello world app
library A module other projects can require()Select blank for now.
? Language
> lua Your typical lua project
teal Typed lua with type checking support
moonscript A dynamically typed whitespace based languageYou can use whatever language you want. We’ll use lua, of course.
Adding Dependencies
Adding dependencies is as simple as lde add inside of your project
Dependencies are stored in a global cache for performance and space conservation, but they are symlinked into your local project as to not pollute your PATH.
Git
You can add dependencies directly from git repositories using the --git flag, or the shorthands gh:, codeberg:, etc.
lde add hood --git https://github.com/bycruz/hood
# or use this for short:
lde add gh:bycruz/hoodRegistry
The lde registry is a centralized place to find and install dependencies, it allows easy discovery of dependencies with proper versioning.
lde add processYou can also add luarocks packages this way with the rocks: prefix.
lde add rocks:luasocketRunning Your Project
Running lde run will run your project’s entrypoint (./src/init.lua) using the embedded LuaJIT engine.
lde run
# 'Hello, world!' is printed to the consoleRunning Lua Tools
Run any remote tool easily with ldx!
ldx cowsay hi ----
< hi >
----
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||This is the equivalent of manually installing the package, then going into the directory and running lde run.
Test Your Code
If you can run your code with lde, you should be able to test that it works.
That’s why lde ships with a minimal built-in test framework, known as lde-test.
local test = require('lde-test')
test.it("should add numbers", function()
test.equal(2, 2)
end)
test.it("should not be equal", function()
test.notEqual(2, 3)
end)Simply write this file, and then run lde test to see the results.
You can also get test coverage to ensure you’re testing your full codebase with lde test --coverage.
Compile Your Code
Now, we can add dependencies, run and even test our code. But this is all pointless if our code stays on our machine!
This is why you can compile into a single executable without any dependencies, not even on lua.
lde compileNext Steps
- Download lde if you haven’t already.
- Take a look at the list of guides for using lde in your favorite environments!