Your Docusaurus site did not load properly.

A very common reason is a wrong site baseUrl configuration.

Current configured baseUrl = / (default value)

We suggest trying baseUrl =

TypeScriptToLua

Write Lua with TypeScript

Playground
function onAbilityCast(this: void, caster: Unit, targetPos: Vector) {
const units = findUnitsInRadius(targetPos, 500);
const enemies = units.filter(unit => caster.isEnemy(unit));
for (const enemy of enemies) {
enemy.kill();
}
}
function onAbilityCast(caster, targetPos)
local units = findUnitsInRadius(targetPos, 500)
local enemies = __TS__ArrayFilter(
units,
function(____, unit) return caster:isEnemy(unit) end
)
for ____, enemy in ipairs(enemies) do
enemy:kill()
end
end

Extend existing APIs

This project is useful in any environment where Lua code is accepted, with the powerful option of simply declaring any existing API using TypeScript declaration files.

Type Safety

Static types can ease the mental burden of writing programs, by automatically tracking information the programmer would otherwise have to track mentally in some fashion. Types serve as documentation for yourself and other programmers and provide a ‘gradient’ that tells you what terms make sense to write.

IDE Support

Types enable Lua developers to use highly-productive development tools and practices like static checking and code refactoring when developing Lua applications. TypeScript extensions are available for many text editors.