| View previous topic :: View next topic |
| Author |
Message |
cools
Joined: 04 Mar 2006 Posts: 46
|
Posted: Thu Jun 15, 2006 7:07 am Post subject: System.listDirectory() |
|
|
| 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! |
|
| Back to top |
|
 |
be2003
Joined: 20 Apr 2006 Posts: 144
|
Posted: Thu Jun 15, 2006 3:07 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
romero126
Joined: 24 Dec 2005 Posts: 200
|
Posted: Thu Jun 15, 2006 4:46 pm Post subject: |
|
|
that was totally uncalled for be2003.
But heres the answer you are waiting for.
| Code: |
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 |
|
| Back to top |
|
 |
cools
Joined: 04 Mar 2006 Posts: 46
|
Posted: Fri Jun 16, 2006 1:22 am Post subject: |
|
|
| Thanks romero126! |
|
| Back to top |
|
 |
|