Skip to content

hazzard993/LuaToTypeScript

Repository files navigation

Lua To TypeScript

npm

Transpiles Lua to TypeScript declaration and/or TypeScript source code.

npm install -g lua-to-typescript

To transpile files...

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 type annotations for type information that is used in generated TypeScript code.

--- @tparam number a
--- @treturn number
local function f(a)
  return a
end

return a

Loosely translates to the below code. Note the type annotations.

function f(a: number): number {
  return a;
}

export = f;