I made definition files so that LSP can support pico8/picotron's library functions and special syntax, so that pico8/picotron programs can be written in external editors such as VSCode while getting the help of various modern features.
How to
- Install and enable sumneko/Lua extensions in VSCode Marketplace
-
Download pico-api
- New a folder .vscode in your workspace, and put the file setting.json into it
- Change the field Lua.workspace.library in .vscode/settings.json to the path to the folder picotron(or folder pico8, depending on the type of your project)
- New a cartridge and use this snippet at the top of its code:
-- picotron cd("/myproj") include("main.lua") -- pico8 [ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=131319#p) |
I found a simple way to use printh on Windows without any setup by using Terminal in VSCode.
Using Lnk file
- Drag and drop the lnk of PICO-8 into VSCode Terminal;
- Press Enter to run it;
- Use
printh
in PICO-8!
Now printh will output its info to VSCode Terminal.
Using p8 file in VSCode
And if you set pico-8.exe as the default program to open your p8 file, you can just drag and drop your p8 file in the VSCode to Terminal. It will open PICO-8 and load the cart and printh
still works.
Another way by editing lnk file: https://www.lexaloffle.com/bbs/?tid=42367
@zep There is a mistake in the PICO-8 manual.
6.14 Additional Lua Features > Coroutines > costatus(c) Return the status of coroutine C as a string: "running" "suspended" "dead" |
The status "normal" is missing.
When coroutine A calls coroutine B, and you check the status of A in B, you will get "normal".