GithubHelp home page GithubHelp logo

triplefrequency / roblox-ts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from roblox-ts/roblox-ts

0.0 2.0 0.0 258 KB

A TypeScript-to-Lua Compiler for Roblox

Home Page: https://roblox-ts.github.io/

License: MIT License

Lua 16.92% TypeScript 83.08%

roblox-ts's Introduction

roblox-ts

A TypeScript-to-Lua Compiler for Roblox
 

Why?

As Roblox games become increasingly complex and larger in size, writing safe code becomes challenging with Lua. In addition, Lua is difficult to make tooling for. Roblox Studio attempts to provide things like intellisense and autocomplete, but it's mostly just guessing.

roblox-ts attempts to solve this problem by compiling TypeScript code into (Roblox flavored) Lua code.

Documentation

⚠️ Documentation is a work in progress. ⚠️

https://roblox-ts.github.io/

Getting Started

Installation & Usage

In order to start using roblox-ts, you'll need to have NodeJS and npm installed. You can download both from here.

Next, from your command line install roblox-ts: npm install -g roblox-ts
(UNIX systems may need you to prefix this command with sudo)

You can now run roblox-ts with the command rbxtsc.

Usage: rbxtsc [options]

Options:
  -w, --watch        enable watch mode                                 [boolean]
  -p, --project      project path                                 [default: "."]
  -i, --includePath  folder to copy runtime .lua files to   [default: "include"]
  --noInclude        do not copy runtime .lua files             [default: false]
  -v, --version      show version information                          [boolean]
  -h, --help         show help                                         [boolean]

Project Folder Setup

We recommmend that you write your TypeScript in VS Code for the best experience. However, also editors like Sublime Text and Atom are supported.

  1. Create a new folder and name it whatever you'd like. For example: MyCoolProject

  2. Run npm init -y inside of your folder. This will create your package.json file.

  3. Create a folder called src to contain your TypeScript files.

  4. Create a file named tsconfig.json in your project folder. The contents should look like this:

{
	"compilerOptions": {
		"outDir": "out",
		"rootDir": "src",
		"baseUrl": "src",
		"module": "commonjs",
		"strict": true,
		"noLib": true,
		"downlevelIteration": true,
		"declaration": false,
		"target": "es6"
	},
	"typeAcquisition": {
		"enable": true
	}
}

(warning: do not change these values unless you know what you are doing!)

  1. Create a file for syncing your compiled .lua files to Roblox Studio. If you're using Rojo, this should be a rojo.json file and look like:
{
	"partitions": {
		"include": {
			"path": "include",
			"target": "ReplicatedStorage.RobloxTS.Include"
		},
		"modules": {
			"path": "modules",
			"target": "ReplicatedStorage.RobloxTS.Modules"
		}
	}
}

You should add more partitions for the subfolders of your out folder.

  1. Run npm install rbx-types to install the Roblox API type definitions.

  2. Start roblox-ts in watch mode rbxtsc -w

  3. Run your sync program. If you're using Rojo, this is rojo serve

  4. Write code!

Join the Community!

https://discord.gg/f6Rn6RY

Credits

roblox-ts is powered by is powered by ts-simple-ast and is inspired by TypescriptToLua

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.