Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hazzard993/luatotypescript

Converts Lua code to TypeScript
https://github.com/hazzard993/luatotypescript

lua transpiler typescript

Last synced: 5 days ago
JSON representation

Converts Lua code to TypeScript

Awesome Lists containing this project

README

        


Lua To TypeScript


npm

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;
```