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

typescript-to-lua

Package Overview
Dependencies
Maintainers
1
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescript-to-lua

Typescript to lua transpiler.

  • 0.0.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1K
decreased by-40.35%
Maintainers
1
Weekly downloads
 
Created
Source

TypescriptToLua

Typescript to lua transpiler.

Build Status

Usage Guide

npm install -g typescript-to-lua

tstl path/to-my-file.ts

Optionally: Add the lualib files from dist/ to your project. This helper library unlocks additional typescript functions:

  • Ternary operator
  • Functional-style list operations (forEach/map/filter/every/some)
  • Includes lua Map<S,T> and Set<T> implementations Add require("typescript") in your code code if you want to use the lualib functionality.

Transpiling a TypeScript project to Lua

The compiler will automatically try to find a typescript configuration file tsconfig.json in the files. If found it will transpile all TypeScript files in subdirectories of the project.

To prevent accidental compilation to Lua, you are required to add a "target": "lua" entry in your tsconfig compilerOptions.

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", "$file"]
}

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 17 Feb 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