Log In  

Cart #magic-0 | 2023-11-07 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

Maaaaaaagic

this cart can detect if you are on bbs/SPLORE or on pico-8 editors.

Basically, it detects if you've loaded the cart from online, or have it locally saved. the only way to load from online is from bbs/splore, so its easy to assume its one of the two.

How this works:

Pico-8 carts can use ls() to get a list of files in the current directory. online-loaded carts have no access to the filesystem and bbs has no filesystem, so in those cases ls is returned as NIL. when the cart is saved, only possible on a pico-8 editor, ls() returns as " " or whatever files you have in your carts dir. this cart detects what platform you are on by checking if ls() is equal to nil or not nil, then doing something accordingly.

feel free to use this concept whenever you like!

P#137098 2023-11-07 21:59 ( Edited 2023-11-07 22:10)


[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-02-22 03:31:36 | 0.009s | Q:13