
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
typescript-to-lua
Advanced tools
A generic TypeScript to Lua transpiler. Write your code in TypeScript and publish Lua!
A generic TypeScript to Lua transpiler. Write your code in TypeScript and publish Lua!
More detailed documentation and info on writing declarations can be found on the wiki.
Install
npm install -g typescript-to-lua
Compile Files
tstl path/to-my-file.ts path/to-my-other-file.ts
Compile Projects
tstl -p path/to-my/tsconfig.json
Options
Syntax: tstl [options] [files...]
In addtion to the options listed below you can also pass options for the
typescript compiler (For a list of options use tsc -h). NOTE: The tsc options
might have no effect.
Options:
--version Show version number
--luaTarget, -l Specify Lua target version: 'JIT' (Default), '5.1', '5.2',
'5.3'
--project, -p Compile the project given the path to its configuration file,
or to a folder with a 'tsconfig.json'
--help Show this message
Optionally: Add the lualib files from dist/ to your project. This helper library unlocks additional typescript functions:
Map<S,T>
and Set<T>
implementations
Add require("typescript")
in your code code if you want to use the lualib functionality.This compiler works great in combination with the Sublime Text Typescript plugin (available through the package manager as TypeScript
).
You can simply open your typescript project assuming a valid tsconfig.json file is present. The default TypeScript plugin will provide all functionality of a regular TypeScript project.
To add the option to build with the Lua transpiler instead of the regular typescript compiler, go to Tools > Build System > New Build System...
. In the new sublime-build file that opens, enter the following (adjust path to tstl if not installed globally):
{
"cmd": ["tstl", "-p", "$file"],
"shell": true
}
Save this in your Sublime settings as a TypeScriptToLua.sublime-build
. You can now select the TypeScriptToLua build system in Tools > Build System
to build using the normal hotkey (ctrl+B
), or if you have multiple TypeScript projects open, you can choose your compiler before building by pressing ctrl+shift+B
.
FAQs
A generic TypeScript to Lua transpiler. Write your code in TypeScript and publish Lua!
The npm package typescript-to-lua receives a total of 636 weekly downloads. As such, typescript-to-lua popularity was classified as not popular.
We found that typescript-to-lua demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.