Just a simple program I made to test the limits of the LS() command. It cannot see anything other than .p8 and .png files because of the LS() program's limitations. It can load another program and run it if it is in the carts directory. You can also return to it again from that cart in the menu.
You must download it for it to see anything.
You don't have to yell!
function _draw() cls() if stat(102)==0 then dr_boxes() dr_files() dr_menu() rect(2,0,81,127) rect(81,0,89,127) rect(89,0,127,32) controls() else print("this does not work on the bss.") print("you must download it to see anything.") end end
In lua code, rather than the command line, you'd have to pass a string, so you'd need to put quotes around the wildcard pattern.
I don't think the code version of ls() takes an argument, though. In fact, when I just tested it, if you give it an argument, it returns nil instead of a list.
Also, even if it took an argument, you probably wouldn't use "*.*". That particular pattern is kind of a relic of DOS days, when every file intrinsically had a 3-letter extension. You had to type it that way. These days, "*" is what you want if you want to see every file, especially outside of Windows, where "*.*" will limit you to seeing files that literally have a dot in them. Windows tends to quietly treat "*.*" as "*" to make life easier for people with old habits.
Hope you don't mind the thread hijack, but on a related note I think it'd be nice if the runtime version of ls returned directories as well (either via a parameter or just leave the parsing up to us), especially as cd can be used at runtime.
[Please log in to post a comment]