Skip to content

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

Description

@jonasdedden

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions