A template LÖVE 2D TypeScript Project made possible with TypeScriptToLua.
love
should be accessible from the command line. This guide specifies how to do that
You can use Use this template
to clone this repo, or download it as a zip.
yarn # install dependencies
yarn build # build everything
yarn watch # rebuild Lua files every time a TS file is saved (faster)
yarn start # start the game
yarn fix:prettier # tidies up written code
To distribute the game, zip the output in the game/
directory into a .love
archive. See the game distribution wiki page for how to distribute this or check out love-release for a more streamlined process.
Importable files can be placed in the res/
directory and referenced them with res/[resource name]
.
e.g.
- new file:
res/input.txt
- main.ts:
love.filesystem.read("res/input.txt")
- It is entirely possible to use existing Lua libraries for a LÖVE 2D project within your TypeScript code
- TypeScriptToLua preserves some
esnext
behaviour. This means you can useArray.map
andnew Error(...)
- GitHub projects can be imported and be tracked as a dependency with
yarn add [username]/[repo]
- The
copyfiles
command line can be used to copy other needed files into thegame/
directory to compile a game (see scripts) - Index arrays at 0
- Lua does not iterate over sparse arrays (arrays with empty values in the middle of them)