| src | ||
| _G.d.ts | ||
| .gitignore | ||
| .prettierrc.json | ||
| eslint.config.mts | ||
| game.p64 | ||
| package.json | ||
| pnpm-lock.yaml | ||
| README.md | ||
| tsconfig.json | ||
TypeScript for Picotron
This is an experimental template project to mix-and-match TypeScript and Lua for your Picotron projects.
Most of the _G.d.ts file has been AI-generated from the official documentation, with progressive manual adjustments.
Important
TypeScript code converted to Lua code is not guaranteed to be correct or efficient. Read the TypeScriptToLua documentation, follow best practices, and review the generated Lua code.
Tip
Several Picotron idiomatic functions can (and should) be used instead of their TypeScript counterparts.
e.g. useerror()instead ofthrow new Error(), ordeli()instead ofarray.splice()to delete single items. This will improve the performance and reduce the size of the generated Lua code.
Setup
Requirements
Create your project
- Create a new project (i.e.
my-project) from this template - Clone
my-projectin your Picotron'sdrivefolder cd my-projectthenpnpm installpnpm build
- Inside Picotron:
- Open the terminal,
cd my-projectthenload game - Edit
main.luato change thecdline tocd("/my-project/build") - Run the game
- Open the terminal,
Development
pnpm devwill watch and rebuild your TypeScript code.pnpm buildis required when you change Lua code.
The resulting code is a single build/bundle.lua file.
Publish
In Picotron
> cd my-project
> load game
- Open the code inside Picotron
- Comment the
cd()line in main.lua - Save
On the host
pnpm build
In Picotron
Open the terminal:
> cp -f /my-project/build/bundle.lua /ram/cart/bundle.lua
> save
> export my-project.bin