makspll / makspll/bevy_mod_scripting

Add a native Luau (.d.luau) backend for LAD files

Open
#545 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
649
Forks
59
PR merge metrics
No merged PRs in 30d

Description

Add a native Luau (.d.luau) backend for LAD files

Problem

ladfile_builder ships LAD post-processors for the Lua Language Server (--- @class .lua) and mdbook, but there's no native Luau one. luau-lsp can't consume the LuaLS dialect — it expects declare class … end / declare name: T syntax.

The luau runtime feature already exists, so you can run Luau scripts against Bevy, but there's currently no way to type-check them against the reflection registry.

Proposal

A native Luau backend in ladfile_builder, behind a luau_files feature, mirroring how lua_language_server_files is wired:

  • a pure lad_to_luau(&LadFile, …) -> String conversion, and
  • a LuauLadPlugin implementing LadFilePlugin, added to default_processors().

It would be a feature-gated module rather than a separate crate (like the LuaLS backend), since it's pure string generation over the ladfile types and needs no new dependencies.

Scope of a first cut:

  • declare class for reflected types (with focus_crates to keep output readable), host global functions, and non-static instance handles like world;
  • handle Luau grammar edges (reserved words, the unit type, static-vs-instance globals);
  • unknown types resolve to any.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the existing lua_language_server_files feature in ladfile_builder, especially default_processors() and the LadFilePlugin implementation. Add the feature-gated lad_to_luau conversion and LuauLadPlugin, covering declare class output, host globals, instance handles, grammar edge cases, and unknown types as any. Done means the backend is wired without new dependencies and produces valid Luau declarations.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, rust
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.