https://github.com/ASDAlexander77/TypeScriptLua
The TypeScriptLUA repo contains the complete source code implementation for TypeScript compiler for LUA bytecode
https://github.com/ASDAlexander77/TypeScriptLua
binary lua typescript typescript-compiler
Last synced: 7 months ago
JSON representation
The TypeScriptLUA repo contains the complete source code implementation for TypeScript compiler for LUA bytecode
- Host: GitHub
- URL: https://github.com/ASDAlexander77/TypeScriptLua
- Owner: ASDAlexander77
- Created: 2018-08-16T13:11:37.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-11-05T12:58:11.000Z (over 5 years ago)
- Last Synced: 2024-05-01T17:22:35.797Z (about 1 year ago)
- Topics: binary, lua, typescript, typescript-compiler
- Language: TypeScript
- Size: 13.5 MB
- Stars: 60
- Watchers: 7
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
TypeScript for Lua
===========================The TypeScriptLua repo contains the complete source code implementation for TypeScript compiler for Lua bytecode.
Chat Room
---------Want to chat with other members of the TypeScript for Lua community?
[](https://gitter.im/TypeScriptLua/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Engage, Contribute and Provide Feedback
---------------------------------------Some of the best ways to contribute are to try things out, file bugs, and join in design conversations.
License
-------TypeScriptLua is licensed under the MIT license.
Quick Start
-----------Prerequisite: nodejs, Lua 5.3, VSCode
1) Build Project
```
npm install
npm run build
```2) Compile test.ts
create file test.ts
```TypeScript
declare var print: any;class Person {
protected name: string;
constructor(name: string) { this.name = name; }
}class Employee extends Person {
private department: string;constructor(name: string, department: string) {
super(name);
this.department = department;
}public get ElevatorPitch() {
return `Hello, my name is ${this.name} and I work in ${this.department}.`;
}
}let howard = new Employee("Howard", "Sales");
print(howard.ElevatorPitch);
``````
node __out/main.js test.ts
```Now you have test.lua
3) Run it.
```
lua test.lua
```Result:
```
Hello, my name is Howard and I work in Sales.
```Enjoy it.
How to use JavaScript Library
-----------1) Compile JavaScript Library
```
cd experiments\jslib
node ../../__out/main.js -singleModule
```2) Copy JS.lua into your folder where you run the compiled app.
3) Compile test.ts
create file test.ts
```TypeScript
class Person {
protected name: string;
constructor(name: string) { this.name = name; }
}class Employee extends Person {
private department: string;constructor(name: string, department: string) {
super(name);
this.department = department;
}public get ElevatorPitch() {
return `Hello, my name is ${this.name} and I work in ${this.department}.`;
}
}let howard = new Employee("Howard", "Sales");
console.log(howard.ElevatorPitch);
``````
node __out/main.js test.ts
```4) Run it.
```
lua -e "require('./JS')" test.lua
```Result:
```
Hello, my name is Howard and I work in Sales.
```Enjoy it