Log In  

Does anybody have any info on what this command line parameter is? I tried a little bit of experimentation, but I didn't see anything different. The API functions are always global, otherwise how would pico-8 even work? What is this and how is it useful for debugging?

https://www.lexaloffle.com/dl/docs/pico-8_manual.html#Commandline_parameters

-global_api n           1 to leave api functions in global scope (useful for debugging)
P#124309 2023-01-14 20:33 ( Edited 2023-03-17 20:18)

it’s an old optimization to put all pico8 functions as lua ‘locals’ (like pset,spr…)

could have broken some carts hence the flag

P#124312 2023-01-14 21:36

comes from this:

the key is that local here means that the variables are local to the scope of the whole cart, not to one function or block.

P#124318 2023-01-14 23:10

Oh that is a cool optimization! I guess that is why _G is nil. But wait, all the locals are still in _ENV table, right? I wonder if that table typically does not get indexed in our code and that’s why this optimization works.

P#124332 2023-01-15 02:57

yes, the built-in functions are not removed from _ENV, this trick is about adding them to the local (cart) scope to get a little faster access.

P#124333 2023-01-15 03:29

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-02-26 10:38:30 | 0.008s | Q:14