Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typescript-to-lua

Package Overview
Dependencies
Maintainers
2
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescript-to-lua

A generic TypeScript to Lua transpiler. Write your code in TypeScript and publish Lua!

  • 0.4.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

TypescriptToLua

A generic TypeScript to Lua transpiler. Write your code in TypeScript and publish Lua!

Large projects written in lua can become hard to maintain and make it easy to make mistakes. Writing code in TypeScript instead improves maintainability, readability and robustness, with the added bonus of good IDE support. This project is useful in any environment where Lua code is accepted, with the powerful option of simply declaring any existing API using TypeScript declaration files.

Build Status Build status Coverage Gitter chat

Documentation

More detailed documentation and info on writing declarations can be found on the wiki.

Usage Guide

Install

npm install -g typescript-to-lua

Compile Files

tstl path/to/file.ts path/to/other-file.ts

Compile Projects

tstl -p path/to/tsconfig.json

Example tsconfig.json

{
    "compilerOptions": {
        "noImplicitAny" : true,
        "noImplicitThis" : true,
        "alwaysStrict" : true,
        "strictNullChecks": true
    },
    "luaTarget": "JIT"
}

Declarations

The real power of this transpiler is usage together with good declarations for the Lua API provided. Some examples of Lua interface declarations can be found here:

Sublime Text integration

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.

Setting up a custom build system

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

Package last updated on 01 Jul 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc