Limits
The limits exist so that a script, including one with a bug in it, cannot freeze or crash a panel. Passing one stops the script with an error message; it never harms the panel. Upload a corrected script and carry on.
Scripts
Section titled “Scripts”| Limit | Value | When you pass it |
|---|---|---|
| Script size | 24 KB | The editor does not upload it |
| Script name | 32 characters | The editor shortens it |
| Memory | 512 KB | “not enough memory” |
| Lua work per frame | 2,000,000 instructions | “instruction budget” error |
dt |
0.25 s at most | A longer gap is reported as 0.25 |
The work limit is about 490 instructions per pixel for a script that touches every pixel of a 64 × 64 panel in Lua. An interpreted shader that uses vectors goes over it; a compiled one does not count against it at all.
A script is not stored. After the panel restarts it shows its built-in scene until you upload again.
Uniforms
Section titled “Uniforms”| Limit | Value |
|---|---|
| Uniforms sent from outside | 16 |
| Name length | 15 characters |
| Components | 1 to 4 numbers |
Compiled shaders
Section titled “Compiled shaders”| Limit | Value | When you pass it |
|---|---|---|
| Instructions per shader | 1,024 | Compile error |
| Instructions before optimizing | 8,192 | Compile error |
| Copies of helper functions | 1,024 | Compile error |
| Values alive at once | 32 | Compile error, with the line |
| Different constants | 256 | Compile error |
| Declared uniforms | 16 | Compile error |
Passes of one for loop |
64 | Compile error |
fbm octaves |
8 | Compile error |
| Cost of one shader, per pixel | 1,000 | Compile error |
| Cost of all fills in one frame, per pixel | 1,000 | gfx.fill stops the script |
Cost is explained under What compiles.
| Limit | Value | When you pass it |
|---|---|---|
| Vertices per mesh | 1,024 | gfx.mesh raises an error |
| Triangles per frame | 2,048 | gfx.draw stops the script |
| Pixels filled per frame | 16 times the canvas | gfx.draw stops the script |
| Lights | 4 | Error |
| Texture side | 64, a power of two | gfx.texture raises an error |
Numbers
Section titled “Numbers”Numbers are 32-bit: floats carry about seven significant digits, integers wrap around past ±2,147,483,647. A time counter kept in a float gets coarser as it grows (after a day it moves in steps of several milliseconds); wrap it (time = time % 3600) if a script is meant to run for days.
Colour
Section titled “Colour”The canvas stores 5 bits of red, 6 of green and 5 of blue. Shader output is dithered: where a colour falls between two of those levels, neighbouring pixels alternate between them in a fixed pattern, so gradients stay smooth. The 2D drawing calls are not dithered.