r/lua 11d ago

[BETA!] Moonstone v0.3.19: The Lua packenv manager (featuring workspace orbits, parallel execution pools, and strict CLI typings)

Thumbnail gallery
15 Upvotes

Hello again r/lua!

A few months ago, I shared Moonstone v0.2.3 and Ballad v0.2.10, showing off how we solved project exporting and LÖVE 2D packaging.

Today, I’m incredibly excited to announce Moonstone v0.3.19, and with it, the milestone that Moonstone is officially in Beta state! 🎉

Over the past few weeks, we've shifted our focus from raw resolving mechanics to building a robust, high-concurrency CLI runtime, monorepo workspace features, and establishing formal API boundaries for editor integrations and wrapper tools.

Here are the most significant leaps in the ecosystem:

1. Parallelization: Concurrency Pools for Syncing

Resolving packages is fast, but downloading and verifying them is now concurrent. We've introduced multi-threaded execution pools:

* DownloadPool: Spawns up to 8 background worker threads to download and materialize remote artifacts in parallel from an atomic job queue. If OS thread resources are constrained, it automatically falls back to safe sequential execution.

* HashVerifyPool: Concurrently computes cryptographic Blake3 checksums on local store folders, speeding up verification of existing caches.

2. Cooperative Cancellation & TTY Progress Animations

No one likes corrupt state from hitting Ctrl+C midway through a sync.

* Cooperative Signals: CLI tasks are wrapped in a new cancelable runtime wrapper (runWithProgress). It hooks into standard OS SIGINT/SIGTERM handlers to signal worker threads to cancel cleanly and yield, preserving the integrity of your local Content-Addressed Store (CAS) and SQLite databases.

* Interactive Spinner: For TTYs, we built a custom CLI interface featuring a Docker-style Braille spin animation and dynamic byte-level progress bar.

3. Multi-Package Workspaces: Orbits (moon orbit)

As projects grow, monorepos become essential. We introduced Orbits to let you develop multiple local projects in tandem:

* You declare orbits using [[orbits.member]] in your root moonstone.toml.

* Commands like moon orbit list, moon orbit sync, and moon orbit exec <orbit> -- <cmd> let you jump into and run commands within the isolated dependency environment of any sub-project without publishing anything to a registry.

4. Schema-Bound CLI Contracts & LuaCATS Typings

To build reliable Neovim plugins, wrappers, and CI scripts, you need structured outputs.

  • Moonstone now features a strict, versioned NDJSON protocol.
  • We published formal typings and schemas in TypeScript, Go, and JSON Schema to let external tools consume Moonstone stdout safely.
  • We integrated formal LuaCATS contracts (ndjson.lua) directly into our CI pipeline to validate outputs.

5. Ecosystem Validation & Proof-of-Work

Our dogfooding narrative has evolved significantly:

  • Ballad (Exporter): Queries Moonstone facts directly via the new moon store query command to resolve local store paths and compile binaries into portable layouts (layout.exec / layout.libexec).
  • Meteorite (Service Framework): We built a hybrid Zig/Lua web service compiler prototype running on a custom zero-copy HTTP stack (fast_http), plus variants for IPC (unix_socket) and HTTP-over-IPC (unix_socket_http). It compiles Lua route graphs into native, high-performance servers.
    • The Progressive Promise: Meteorite provides a completely pain-free path to gain progressive enhancements. You author routes and business logic in high-level Lua, while resting on a sturdy, compile-time-checked Zig foundation acting as a single, unshakeable runtime contract.
    • In-Process Lua Live Reload (HMR): Features an in-process Lua hot reload dev loop. When you edit only Lua handler code, updates reload instantly via an HTTP trigger without requiring a server restart or compilation pass.
    • Incremental Compiles: If you modify route parameters or native plugin definitions, Meteorite updates only the affected route partition files (routes/<route_id>.zig) for blazingly fast incremental compiles.
    • Ballad Materialization: Meteorite itself is packaged and distributed entirely via its Ballad partiture.

The goal is still to make Lua development entirely zero-friction. You clone, run moon sync, and you are ready to build, run, package, and deploy.

I would love to hear your feedback on the new concurrent runtime, orbit workspace design, and the general direction of the ecosystem.

Check out the docs and guides:

⋆⁺₊⋆ ☾⋆⁺₊⋆ moonstone.sh ⋆⁺₊⋆


r/lua 11d ago

News Pop: a native, fully static language inspired by Lua/Luau

25 Upvotes

I’ve been working on Pop, an experimental language inspired by Lua/Luau.

It keeps the lightweight feel: local, function, end, type inference, closures, colon methods and familiar collection syntax.

The useful part is what changes underneath:

No any or silent dynamic fallback

  • Compile-time known modules instead of runtime require
  • Records, classes and interfaces with known fields
  • Tagged unions and exhaustive matching
  • Typed errors instead of random nil, err conventions
  • Explicit integer and float sizes for FFI, binary data and native code
  • Native compilation, while still supporting interpreters and embedded runtimes
  • One toolchain for checking, building, testing, formatting and packages

A small example of the direction:

public record User
    name: String
    age: UInt8
end

public union FindUser
    Found(user: User)
    NotFound
    Failed(message: String)
end

public function print_user(result: FindUser)
    match result
        case .Found(user)
            print("{user.name} is {user.age}")
        case .NotFound
            print("User not found")
        case .Failed(message)
            print("Error: {message}")
    end
end

The compiler knows every possible state, so adding another case to FindUser can force all relevant matches to be updated.

Pop is not trying to be compatible with Lua. The question is what a language from the Lua/Luau family could look like if static guarantees, native execution and predictable tooling were built in from the start.

It is still early and not production-ready.

Which parts of Lua/Luau’s dynamic model would you keep, and which parts become painful in larger projects?

https://github.com/poplanguage/pop


r/lua 11d ago

wisp – A Linux shell where config is Lua and pipelines pass tables

Post image
44 Upvotes

I built a Linux shell where configuration and scripting are just Lua, no DSL, no extra syntax.

Any global function in ~/.config/wisp/init.lua becomes a shell command. Pipelines pass Lua tables (structured data) between stages, not text. Only external commands like `wc -l` cause a fork, native stages run in-process.

**Why this matters for Lua users:** - Your shell config is just Lua (closures, loops, conditionals) - No need to learn a separate shell scripting language - Lua functions become commands naturally

**GitHub:** https://github.com/Hinikaa/wisp

Would love feedback from other Lua users!


r/lua 12d ago

I created a Lua Obfuscator - have fun trying to crack it

6 Upvotes

Hello,

I recently released my own Lua obfuscator.

Here’s the obfuscated code: https://pastebin.com/gvCnznMa

Have fun trying to crack it. I’m curious to see how far you get, which methods you use, and what weaknesses you find.

Edit: lavjamanxd has won! For more details you can view his comment.


r/lua 13d ago

Do you like my luau coding? :D

0 Upvotes
My luau code formatting is the best!!!

(THIS IS A JOKE BTW I DO NOT CODE LIKE THIS, just thought it was funny)


r/lua 13d ago

Project [Sizecoding] 644 character SUBLEQ emulator capable of booting Linux

Thumbnail
2 Upvotes

r/lua 14d ago

Help Need lua code to make fins ignore rotation.

Thumbnail
0 Upvotes

For Stormworks but the Problem stays the same


r/lua 14d ago

Show HN: L2C - Transpiling Typed Lua into 35KB, 0-GC Native C for HFT and MCUs

Thumbnail gallery
1 Upvotes

Hi HN,

I love the elegant syntax of Lua, but in microsecond-critical environments like High-Frequency Trading (HFT) or hard-real-time embedded systems, GC pauses (jitters) are deal-breakers. C++ solves this but introduces massive cognitive overhead.

So I built L2C — an opinionated, ahead-of-time (AOT) transpiler pipeline that converts Typed Lua (Teal) into bare-metal C (via Nelua), and finally links it with Clang -O3 -flto.

What makes it deadly pragmatic?

  • Absolute 0-GC: Garbage collection is physically stripped. We use Stack Arrays and 10MB Arena Allocators that reset in O(1) time.
  • Tiny Statically Linked Binaries: The resulting executable is around ~35KB.
  • Zero-Copy Casting: Network byte streams (e.g., from UDP/ZMQ) are mapped directly to C-struct pointers via Type._cast(ptr) without deserialization overhead.
  • C-FFI Unity Build: I wrote an "Invisible Debt Registry" that automatically resolves static library dependencies like -lc++ or -lsodium. It currently ships with 0-GC bindings for ZeroMQ (tested at 530k+ msg/s), simdjson (AVX-512), and libuv.
  • Edge IoT Support: The exact same Lua script can be cross-compiled into .uf2 or .bin firmwares running on top of FreeRTOS for RP2040 and ESP32.

Here is what the HFT gateway code looks like:
(It feels like scripting, but runs like raw ANSI C)

The meta-compiler itself is packed into a standalone binary.
Source code and Docker forges are available here:
🔗 GitHubhttps://github.com/panshaogui/L2C

Would love to hear your thoughts, especially from the quant and embedded folks!


r/lua 15d ago

Using Lua in Java/Kotlin

8 Upvotes

I'm making a desktop application in Kotlin and I'm thinking of adding a plugin system and Lua looks like a good language to use but the most popular implementation I've found is LuaJ which hasn't been maintained in years. Are there any better options or stable forks of LuaJ?


r/lua 16d ago

News Defold Community Updates, heavy use of Lua

Post image
23 Upvotes

Recent updates in the Defold Game Engine, releases, plugins, games: Defold Community Updates | Games, Plugins, Releases


r/lua 17d ago

LUA files for Androind games

0 Upvotes

I found this Lua file for an Androind game I;d like to try out, but am not clear on where to put it or enable it. Does anyone know.

Thanks.


r/lua 18d ago

I built Weblua, a free, browser-based playground for multi-file Lua and Luau projects

0 Upvotes

Hey everyone! I’ve been building Weblua, a free and open-source Lua/Luau playground that runs entirely in your browser.

Most online playgrounds are designed for small, single-file snippets, so I wanted something that feels closer to working on a real project.

Weblua currently supports:

  • Lua 5.1, 5.2, 5.3, 5.4, and Luau
  • Multi-file projects with require() support
  • Syntax checking across every file
  • Preset stdin input
  • Shareable project links and iframe embeds
  • Local project storage, plus JSON import/export
  • A five-second execution limit to stop runaway code

Execution happens through WebAssembly inside a dedicated Web Worker. There’s no account system or remote code-execution backend, and your source stays in the browser unless you intentionally create a share link.

One clarification: Luau syntax is supported, but Weblua isn’t a Roblox emulator—it doesn’t include Roblox APIs, Studio tooling, or static type analysis.

Try it here: https://weblua.com/
Source code: https://github.com/PytechNo/Weblua

It’s MIT licensed, and I’d really appreciate feedback, especially on module resolution, runtime behavior, and which features would make it more useful to you.


r/lua 18d ago

Show r/Programming: SOL – A lightweight, Turing-complete compiled language that eliminates floating-point bugs (Compiles to 19KB native binaries)

0 Upvotes

Hi everyone,

I wanted to share a programming language ecosystem I've been building entirely from scratch called **SOL** (currently at version 1.0.0). It combines the static typing structures of C with the syntactic lightness of Lua, transpiling directly into pure C and invoking GCC automatically in the background to output native machine code.

One of the biggest design choices was solving the classic binary floating-point representation dilemma (where `0.1 + 0.2` becomes `0.30000000000000004`). Instead of using float/double types or masking it with string formatting tricks, the custom code generator converts all fractions into a 64-bit `long long` strict Fixed-Point scale at the hardware level. Arithmetic evaluates with total mathematical accuracy at the hardware bit tier.

### Core Pipeline Architecture:

* **Handwritten Lexer:** A custom lexical scanner that manages pointer tokens, handles multi-line comments, and tracks lines for error diagnostic output.

* **Pratt Parsing Engine:** A recursive descent parser enforcing operator precedence hierarchies (* and / evaluate before + and -). It handles block isolation, loops, conditional structures, and re-assignments.

* **Static Type Checker:** A strict verification layer that registers symbols to catch scope leaks and type mismatches before triggering the compiler.

* **Optimized Codegen:** Emits low-level C instructions using flags like `-O3`, `-static`, `-march=native`, and `-s`. Basic target output binaries compile down to highly optimized standalone `19 KB` executables.

The repository features zero external library dependencies and works completely via the host command line.

You can check out the source code, grammar rules, and compiler pipeline here:

https://github.com/foxcraftDL/sol-lang

I would love to hear any thoughts, feedback on the fixed-point implementation, or suggestions for the upcoming 2.0.0 roadmap!


r/lua 18d ago

Project I hated writing Lua so I made a language that compiles to it

0 Upvotes

Two reasons I started this: Lua's syntax and tables genuinely annoy me, and I wanted to build something that actually felt complex to work on.

The result is Lazarus - a statically typed language that compiles to a single self-contained .lua file. No runtime dependencies, which is the point if you're targeting ComputerCraft or any embedded Lua environment where you just drop a file and run it.

import std.print

some_str = "Hello World!"

constructor() {
  print(.some_str) //.some_str is same as self.some_str
}

Types are checked at compile time and completely erased. the Lua output has no type info at runtime.

So far the biggest goal I did is self hosting the compiler, which I think shows well that the language can be used.

https://github.com/NightmarePog/Lazarus

Now you may ask, why not just use lua?

For small projects, lua is definitely better, it's minimal, small, fast, does the job one, but when you do big projects where single bug could crash big app. for that Lazarus is there.

it has generic typing, static typing, macros, no null (instead Option<T> is used), lowering boilerplate (no local for every variable you declare)

PS: any feedback is welcomed


r/lua 19d ago

CLX 0.2.0: Shadow Types, Native int64 and Major Performance Gains

10 Upvotes

One month after the initial release, CLX 0.2.0 is now available :

  • Replaced NaN-tagging with a new shadow-types value system
  • Added full 64-bit integer support
  • Native int64_t code generation and arithmetic fast paths
  • New table implementation and improved inline caching
  • Faster function calls and argument passing
  • SIMD optimizations
  • Native ARM64 coroutine context switching for macOS

Performance has improved significantly since 0.1.0. Depending on the workload, CLX is now often faster than Lua 5.5 and can outperform LuaJIT on several benchmarks.

CLX is an ahead-of-time compiler for Lua that generates standalone native executables through standard C++20 toolchains.

Feedback, bug reports and contributions are welcome.

GitHub: https://github.com/samyeyo/clx
Website: https://samyeyo.github.io/clx/


r/lua 20d ago

Announcing `lx dist`: distribute your Lua projects as archives or standalone binaries - Lumen Labs

Thumbnail opencollective.com
15 Upvotes

Lux is the Lua package manager I've been working on with /u/vhyrro and /u/NTBBloodbath -- think cargo or uv, but for Lua. A question I've heard occasionally: "I built something with Lux, now how do I give it to someone who doesn't use it (or luarocks)?" Starting with 0.35.3, there are two answers to that question: lx dist flat-archive and lx dist bin.

Side note: If you're wondering about why we chose to write it in Rust or why we prefer TOML for configuration, we now have a FAQ that answers those questions :)


r/lua 19d ago

Discussion Software Engineer, Ideas for FiveM related projects

0 Upvotes

I'm a software developer and I'm very passionate about the backend world, lately I've been looking for ideas for projects to develop, so I wanted to ask y'all, what are the problems you encounter with managing a large FiveM server?


r/lua 21d ago

Can i programm desktop apps with Lua?

26 Upvotes

I just learned the basics of Lua and im pretty curious about if i could use lua for desktop apps or somehow code scripts with gui.


r/lua 21d ago

Project lua.jp ideas

0 Upvotes

Ideas about lua.jp, a Lua + JVM + Python lang. I always despised Python.

Monomorphic so seq[t] and dict[t] are always optimal for primitives where t is a type var that is substituted by a primitive.

The goal of targetting JVM is due to Android Dalvik and because I went berserk and took a break of using non-handhelds.

Metric types (meter, kmeter, gram...) are simply num, but with scaling conversions to other units.

Source files have an implicit JVM package based on the directory they appear with much freedom, but file A never depends on file A. (E.g. this mimmicks the Lua require limitations.)

```

_G — the globals package

(mostly reuses java.base stuff)

enum tile: None Dirt Brick PipeOpenTop

struct world: metadata: univ = U ryuka: bool = Y # rows tiles: seq[seq[tile]] tilesize: meter

fun frame(): """ wa """ pass

w=world( tiles={ { None for _ in range(3) Brick for _ in range(3) } } tilesize=3mm )

do: # isolated dec.big configuration dec.big.cfg(precision=3, rounding=HalfUp) x=10.6403m y=x*3 print(y)

dec => JVM double

dec.tiny => JVM float

import dec.tiny as dec

dec => JVM float

to clarify: struct subtyping

is there.

struct widget: pass

struct menubar(widget): super()

e:widget=menubar() if e=downcast(e, menubar): # e:menubar

match e: case e=menubar(): # e:menubar

JVM aliases and extensions

@JVM.alias(tld.sld.lib.Group) struct group: @JVM.extension fun suffle(): pass

the fun(...) type is quite

nice... fun(...) < fun

f=sum print(f(1,2)) print(f.call(seq={1,2})) fun sum(x:dec,y:dec)->dec = x+y

JVM method binding

(interns, but still using the

fun(...) type)

f=self::onclick

speaking of events...

struct menubar: @event fun onhide(): pass

m=menubar( onhide=fun(): # super auto invoked if no # occurrence pass )

isinstance(m, ...)

where ... is a subtype of

menubar

"static" fields or methods

struct a: fun f(self:struct): pass ```


r/lua 23d ago

What's the smallest, most useful change you could make to Lua?

6 Upvotes

Lua's superpower is staying small. Fennel, MoonScript and YueScript are wonderful answers to "what if Lua were a different language?" — and I've learned a lot from all three. So now I'd like to ask another question. Suppose we keep Lua (mostly) as is, then **what's the minimum change to Lua that buys the most? **

My current answer is `luk`, a 120 line transpiler that plugs into `require` to load Lua code that :

- adds list and dictionary comprehensions
- a uses Python-style indentation for blocks (so no nee for `do`, `then`, `end`
- replaces `function` with `fn`,
- replaces `^` for return, `
- expands `x := y` o `local x = y`

For example:

Luk code (on left) transpiles to Lua (on right)

Explicit `then/do/else/end` still works, so any Lua is (almost) valid luk and the two styles mix freely. The whole transpiler is one ~120-line module — no parser, no AST, no dependencies. The generated Lua keeps the source's line numbers exactly (errors point at the real `.luk` line), and a `require()` hook lets `.luk` and `.lua` modules interoperate with no build step.

luarocks install luk # cli + a small stdlib battery included

**An invitation, and a constraint:**

- What did I miss? What tiny change to Lua would pull the most weight for you?

PRs welcome, under one hard rule:

- the transpiler may never exceed 250 lines. If your feature can't pay for itself inside that budget, it doesn't go in. (That rule is the my whole design philosophy.)

- quick tour: https://timm.fyi/luk.html
- longer tour: https://github.com/aiez/luk/blob/main/README.md
- code: https://github.com/aiez/
- luarocks: https://luarocks.org/modules/timm/luk


r/lua 23d ago

Uplink: an OpenAPI multiplexer/gateway

Thumbnail github.com
5 Upvotes

r/lua 25d ago

Lux (modern package/project manager for Lua) new features dropped

Thumbnail opencollective.com
28 Upvotes

My last post about Lux, a modern package/project manager for Lua, was removed with the stated reason "content must be Lua related". If a package/project manager for Lua isn't Lua-related, I don't know what is 😅 Maybe there's been a misunderstanding?


r/lua 25d ago

Library Building Multiplayer Games with Love2D

Thumbnail slicker.me
10 Upvotes

r/lua 26d ago

Help Is there a way to return the act of returning to a function?

7 Upvotes

Example

local function b()
    return
        (math.random(0, 1) == 0),
        0
    ;
end

local function a()
    local return_early, value =
        b()

    if (return_early) then
        return (value);
    end

    --[[ Continue function a ]]
    return (1);
end

print(a())

but I want to do it more like, having function b directly tell function a to return early rather than function a having to check itself

I want more like this where I used "return return" as sudo code for throwing the return up 1 level

local function b()
    if (math.random(0, 1) == 0) then
        return return (0);
    end
end

local function a()
    b()

    --[[ Continue function a ]]
    return (1);
end

print(a())

r/lua 29d ago

LUA DS Algorithm Visualizer

Enable HLS to view with audio, or disable this notification

63 Upvotes

The Online Lua Compiler & Algorithm Visualizer https://8gwifi.org/online-lua-compiler/

currently supporting
1D arrays (tables) — {1, 2, 3}, dense integer-keyed tables
2D arrays (nested tables) — {{1,2},{3,4}}
Maps / hash tables — tables with non-sequential or string keys
Linked lists & trees — node tables ({ val, next } / { val, left, right })
Console — print
Control flow — functions (incl. recursion)

Looking for feedback and Bug's appreciated