https://github.com/hazzard993/luatotypescript
Converts Lua code to TypeScript
https://github.com/hazzard993/luatotypescript
lua transpiler typescript
Last synced: 11 months ago
JSON representation
Converts Lua code to TypeScript
- Host: GitHub
- URL: https://github.com/hazzard993/luatotypescript
- Owner: hazzard993
- License: mit
- Created: 2019-07-04T11:39:58.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-09-19T04:37:44.000Z (over 1 year ago)
- Last Synced: 2025-03-12T22:29:47.402Z (11 months ago)
- Topics: lua, transpiler, typescript
- Language: TypeScript
- Size: 441 KB
- Stars: 63
- Watchers: 4
- Forks: 15
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Transpiles Lua to TypeScript declaration and/or TypeScript source code.
```sh
npm install -g lua-to-typescript
```
To transpile files...
```sh
ltts main.lua
# Generates main.ts
ltts a.lua b.lua c.lua ...
# Generates a.ts, b.ts, c.ts, ...
ltts -d library.lua
# Generates library.d.ts
```
## LDoc
This program uses [LDoc](https://stevedonovan.github.io/ldoc/) type annotations for type information that is used in generated TypeScript code.
```lua
--- @tparam number a
--- @treturn number
local function f(a)
return a
end
return a
```
Loosely translates to the below code. Note the type annotations.
```ts
function f(a: number): number {
return a;
}
export = f;
```