File browser

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
thsock
Posts: 25
Joined: Sun Sep 25, 2005 1:04 pm

File browser

Post by thsock »

Is there a tutorial somewhere on writing a file browser? I know Mike Haggar and several others have already done it.
Thanks.
thsock
Posts: 25
Joined: Sun Sep 25, 2005 1:04 pm

Post by thsock »

Ok lol(really easy) i figured out how to list the current directory, but how do i list the contents of the directory?\







OSi 2.0 on the way
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

I don't think there is such a documentation regarding the output of current directory function. All I know is that the output is a list of "subtables" and a few members. Only source I could find for more info is in Lowser. script.

Someone needs to doc the table structure for the output.
Geo Massar
Retired Engineer
MagicianFB
Posts: 11
Joined: Mon Oct 10, 2005 8:45 am

Post by MagicianFB »

Each indice of the results of System.listDirectory(), has three parts.

name: the name of the file
size: the size of the file in bytes
directory: a boolean saying whether the file is a directory/folder

heres a quick example of a code to display the names all files on the root of the memory stick:

Code: Select all

contents = System.listDirectory("ms0:/")

for k in ipairs(contents) do
	print(contents[k].name)
end
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

Is that all, just three indices? What about dates? I wonder.
Geo Massar
Retired Engineer
MagicianFB
Posts: 11
Joined: Mon Oct 10, 2005 8:45 am

Post by MagicianFB »

KawaGeo wrote:Is that all, just three indices? What about dates? I wonder.
When you print all values of an indice by doing the following:

Code: Select all

table.foreach(contents[1], print)
Those are the only three you get.
Post Reply