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) |
it’s an old optimization to put all pico8 functions as lua ‘locals’ (like pset,spr…)
could have broken some carts hence the flag
comes from this:
[tweet ]
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.
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.
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.
[Please log in to post a comment]