I am new to PICO-8 and coding in Lua under its environment. I was wondering, if putting in comments and keeping long names for variables and functions steals memory from the system.
What I know that usually Lua compiles the source code before executing it. All the source code is converted in tokens. But is it the same in PICO-8, I mean, is it stored in ASCII format or in tokens inside the memory?
Is it a good practice to keep short names and minimal comments?
Thank you.



I don't know about good practice, but it is necessary for making some very long carts that overwork the PICO-8's memory. In the bottom-right corner of the PICO-8's code editor, there should be a number out of 8,192. If you click on that number, you will cycle through the three metrics PICO-8 uses to determine if your cartridge is full: token, chars, and compressed capacity. Once one of these is all used up, there will be no more space for code inside of the PICO-8 cartridge.
It can be confusing, but I strongly believe that there is no reason to worry about tokens, unless you are a professional-level game developer. Even if you do run out of tokens you can use shrinko8, the PICO-8 code minifier, to stretch under the limit.
Really, no worries. Even with your best ambitions, hitting the token/capacity limit is an accomplishment that can only be achieved by much longer carts. (At least, this has been my experience.)
For more reading, you can visit here.


Hi Stephen,
Thank you so much for the clarification, actually I thought about How to achieve a good balance between readability of the source code and the amount of memory used.
As the first project with PICO-8 I have built Kronos, Timer Manager.
URL Kronos, Timer Manager
So I was wondering if it's worth to shrink a bit the code reducing the tokens or the characters.
But you're right that's a problem that will present with bigger projects but thank you for the links! As far as I go I am realising that this PICO-8 is a white rabbit hole. It's a great product that teaches a lot.
Thank you so much for your advice.
[Please log in to post a comment]