QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Developers Corner > PSP Development, Hacks, and Homebrew > PSP Development Forum
The above video goes away if you are a member and logged in, so log in now!

[LUA HELP NEEDED] file list in a directory

This is a discussion on [LUA HELP NEEDED] file list in a directory within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; anyone know how to list and store the file names in a directory? im trying to add mp3 playback to ...

Reply
 
LinkBack Thread Tools
Old 12-17-2006, 10:01 AM   #1

PREMIUM Member
 
dragula96's Avatar
 
Join Date: Jun 2005
Posts: 312
Trader Feedback: 0
Default [LUA HELP NEEDED] file list in a directory

anyone know how to list and store the file names in a directory?

im trying to add mp3 playback to my program but need to store the file names in the psp/music/ directory in an array or table

if anyone knows how to do this please share
dragula96 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-17-2006, 10:04 AM   #2
 

 
Join Date: Aug 2006
Location: Cross Country Course
Posts: 794
Trader Feedback: 0
Default

Why didn't you post in the LUA help thread?
PSPgamer512 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-17-2006, 10:07 AM   #3

Designs
 
MSeven's Avatar
 
Join Date: Jul 2006
Location: Canada
Posts: 1,395
Trader Feedback: 0
Default

Quote:
Originally Posted by PSPgamer512
Why didn't you post in the LUA help thread?
how about you just answer his question instead of telling him where to post.

try

files = System.listDirectory()

for index, file in files do
print(file.name)
end
__________________
MSeven is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-17-2006, 10:11 AM   #4

PREMIUM Member
 
dragula96's Avatar
 
Join Date: Jun 2005
Posts: 312
Trader Feedback: 0
Default

Quote:
Originally Posted by yoyomacy
how about you just answer his question instead of telling him where to post.

try

files = System.listDirectory()

for index, file in files do
print(file.name)
end

i tried that but it returns an error at the

for index,file in files do .... line


the error reads " Error: "index.lua:101: attempt to call a table value
Error: No script file found
dragula96 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-17-2006, 10:17 AM   #5

is not posting very often
 
Glynnder's Avatar
 
Join Date: Feb 2006
Location: omnipresent
Posts: 5,161
Trader Feedback: 0
Default

ooo, in the luaDevKit you'll go to the file i/o menu and click list files in current directory
__________________
Quote:
Originally Posted by Abe
Either way, if you don't know, don't guess. Stick to answering questions about stuff you're qualified to answer, like Pokemon questions or something along those lines.
http://forums.qj.net/501501-post26.html
Glynnder is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-17-2006, 10:40 AM   #6

PREMIUM Member
 
dragula96's Avatar
 
Join Date: Jun 2005
Posts: 312
Trader Feedback: 0
Default

Quote:
Originally Posted by Alex G
ooo, in the luaDevKit you'll go to the file i/o menu and click list files in current directory
what?
dragula96 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-17-2006, 10:47 AM   #7

is not posting very often
 
Glynnder's Avatar
 
Join Date: Feb 2006
Location: omnipresent
Posts: 5,161
Trader Feedback: 0
Default

http://forums.qj.net/f-psp-developme...ead-84179.html

my latest project, if there's enough intrest I'll be doing it, seems like it could be right up your street.
__________________
Quote:
Originally Posted by Abe
Either way, if you don't know, don't guess. Stick to answering questions about stuff you're qualified to answer, like Pokemon questions or something along those lines.
http://forums.qj.net/501501-post26.html
Glynnder is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-17-2006, 11:09 AM   #8

PREMIUM Member
 
dragula96's Avatar
 
Join Date: Jun 2005
Posts: 312
Trader Feedback: 0
Default

Quote:
Originally Posted by Alex G
http://forums.qj.net/f-psp-developme...ead-84179.html

my latest project, if there's enough intrest I'll be doing it, seems like it could be right up your street.

well, if its not released yet, would you mind shareing that pice of code with me?
dragula96 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-17-2006, 11:11 AM   #9

sceKernelExitGame();
 
Bronx's Avatar
 
Join Date: Jan 2006
Location: New York
Posts: 3,125
Trader Feedback: 0
Default

Look at the file browser in the Lua snippets thread( bottom )... Always check there before asking
Bronx is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-17-2006, 11:18 AM   #10

is not posting very often
 
Glynnder's Avatar
 
Join Date: Feb 2006
Location: omnipresent
Posts: 5,161
Trader Feedback: 0
Default

@ Bronx, can i use some stuff from that for my app?
So theres an option- add menu... etc...
__________________
Quote:
Originally Posted by Abe
Either way, if you don't know, don't guess. Stick to answering questions about stuff you're qualified to answer, like Pokemon questions or something along those lines.
http://forums.qj.net/501501-post26.html
Glynnder is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-17-2006, 12:56 PM   #11

PREMIUM Member
 
dragula96's Avatar
 
Join Date: Jun 2005
Posts: 312
Trader Feedback: 0
Default

Quote:
Originally Posted by Bronx
Look at the file browser in the Lua snippets thread( bottom )... Always check there before asking

thanks that was helpfull however... i just reolized that the mp3 mod only plays mp3s from your lua programs directory

if i try and give it something like Mp3.load("ms0:/psp/music/myfile.mp3")

it will give me an error like this "error: index.lua:121: can't open sound file ms0:/psp/games/luaplayer20/applications/myapp/ms0:/psp/music/myfile.mp3")

its hardcoded to look for "myfile.mp3" inside your app folder toobad

so theres no way i can make it play from a list inside the psp/music folder



UNLESS someone with better skills then me takes a look at the mp3 mod code and removes that limitation
dragula96 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-17-2006, 01:05 PM   #12
 
Join Date: Dec 2006
Posts: 2
Trader Feedback: 0
Default

Alright ill help you with this and i can help more if youve got an IM oh and im tacticalpenguin but my real account got messed up from a vbplaza bug
anyways
you could do something like this in conjunction with something like my filebrowser:

if pad:circle() and not oldpad:circle() then
if string.lower(string.sub(f iles[s].name, -4)) == ".mp3" then --checks that the file is .mp3
Mp3.load(files[s+2].name)
System.sleep(30)
Mp3.play()
end
end

Just note that that is requiring the System.currentDirectory be the same as the dir the mo3 is in. If youd like, i made a little drop down bar with the psp/music folder contents in it and when you press circle it pays the MP3. If you need any help with file browser-related stuff, i can definitely hel
TPTemp is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-17-2006, 01:16 PM   #13

sceKernelExitGame();
 
Bronx's Avatar
 
Join Date: Jan 2006
Location: New York
Posts: 3,125
Trader Feedback: 0
Default

Quote:
Originally Posted by Alex G
@ Bronx, can i use some stuff from that for my app?
So theres an option- add menu... etc...
Yeah, that's what it i there for. Just contact the original maker to see if they want credit.
Bronx is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-17-2006, 01:23 PM   #14

is not posting very often
 
Glynnder's Avatar
 
Join Date: Feb 2006
Location: omnipresent
Posts: 5,161
Trader Feedback: 0
Default

well, even if they don't they'll get it.

it'll add comments in e.g
--menu code by *author*--
__________________
Quote:
Originally Posted by Abe
Either way, if you don't know, don't guess. Stick to answering questions about stuff you're qualified to answer, like Pokemon questions or something along those lines.
http://forums.qj.net/501501-post26.html
Glynnder is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 12-17-2006, 03:16 PM   #15

PREMIUM Member
 
dragula96's Avatar
 
Join Date: Jun 2005
Posts: 312
Trader Feedback: 0
Default

Quote:
Originally Posted by TPTemp
Alright ill help you with this and i can help more if youve got an IM oh and im tacticalpenguin but my real account got messed up from a vbplaza bug
anyways
you could do something like this in conjunction with something like my filebrowser:

if pad:circle() and not oldpad:circle() then
if string.lower(string.sub(f iles[s].name, -4)) == ".mp3" then --checks that the file is .mp3
Mp3.load(files[s+2].name)
System.sleep(30)
Mp3.play()
end
end

Just note that that is requiring the System.currentDirectory be the same as the dir the mo3 is in. If youd like, i made a little drop down bar with the psp/music folder contents in it and when you press circle it pays the MP3. If you need any help with file browser-related stuff, i can definitely hel


ok well thanks, im just gonna load the mp3s from my program folder and give up on the psp/music folder,

thanks for the code for checking if mp3 file verri nice.

enyway the program i was working on is a life counter for Warcraft Trading Card Game.

its pretty handy up and down increas and decrease your life counter and

triangle and x increase derease your opponent's life.


and i just wanted to have some sort of music playing while we dual it out.

here is a screen shot:
dragula96 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
directory , file , list , lua , needed

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 11:52 AM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2009, QJ.NET. All Rights Reserved.
Contact Us