Skip to content

PZ-Umbrella/pz-lua-stubgen

Repository files navigation

pz-lua-stubgen

A command-line tool for generating Lua typestubs that are compatible with EmmyLua and LuaLS.

The primary purpose of this tool is to generate the Lua typestubs included in Umbrella. Since it's made with Project Zomboid in mind, it includes some heuristics and class definitions that are specific to that codebase.

Installation

You can install the tool using npm:

npm i
npm run build

Usage

The primary command of the tool generates typestubs given a Lua source directory. From the top-level directory, use:

pz-lua-stubgen -i <input-directory> -o <output-directory>

On Linux, use ./pz-lua-stubgen instead.

When building stubs for Umbrella, some additional flags that should probably be included:

  • -k, to include a stub for Kahlua. Note that some classes used in this stub are assumed to be defined elsewhere (for Umbrella, they're defined in the Java stubs).
  • -r <stub-data-directory>, to include Rosetta stub data.
  • --helper-pattern ^umbrella\., to avoid emitting globals for umbrella helper classes.
  • --no-ambiguity, to avoid emitting analyzed union types.

For information about other commands and the other available options, use pz-lua-stubgen --help.

About

Typestub generator for Project Zomboid's Lua source

Resources

License

Stars

Watchers

Forks

Contributors