System.listDirectory()

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

Moderators: Shine, Insert_witty_name

Post Reply
cools
Posts: 46
Joined: Sat Mar 04, 2006 12:57 pm

System.listDirectory()

Post by cools »

Whenever I use that function, it never works the way I want it to. All I want to do is list the contents in a directory, but I just cant seem to do it. It will always return errors about stuff. Well all help is apprciated!
be2003
Posts: 144
Joined: Thu Apr 20, 2006 2:46 pm

Post by be2003 »

ahh... newbs cant ever read any tutorials

System.listDirectory() returns a table not a string. you can only print strings to the screen using screen:print() you must turn the table into string by listing its contents with a function. look at how it lists the connection configs in the Wlan sample, just replace the configs = Wlan.getConnectionConfigs() so it says configs = System.listDirectory and learn how to use google and dont freaking say that u did.
- be2003
blog
romero126
Posts: 200
Joined: Sat Dec 24, 2005 2:42 pm

Post by romero126 »

that was totally uncalled for be2003.

But heres the answer you are waiting for.

Code: Select all


file_list = System.listDirectory() 
for key, file in file_list do
print("File Name".. file.name.." : ".. file.size)
if (file.directory()) then
-- this is where you put directory stuff

end


end
for more information about system directorys please refer to the LUA refrence tutorial http://wiki.ps2dev.org/psp:lua_player:functions#system please bookmark this link
cools
Posts: 46
Joined: Sat Mar 04, 2006 12:57 pm

Post by cools »

Thanks romero126!
Post Reply