Loading/Iterating through an images folder to store in a table

Hello!

I’m relatively new to Corona SDK development, but have been working exclusively in iPhone dev for roughly 2 years now…

So, here’s my question!

I’m trying to create a slideshow that loads screenshots for a movie.

I want to code my class file so that it automatically counts the “Images” folder and then iterates through the images into the slideshow.

How would I begin to approach that using Lua and the Corona SDK?

Thank you very much for your help! :smiley: [import]uid: 10211 topic_id: 16975 reply_id: 316975[/import]

You would simply iterate through every image filename found in the folder and assign them to a table.

[import]uid: 84637 topic_id: 16975 reply_id: 63665[/import]

@Danny, that is interesting, how do you enumerate the files in a directory using CoronaSDK?

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 16975 reply_id: 63670[/import]

I can provide a proper example in a few hours.

But basically you would use lua’s io library to read the contents of a folder [import]uid: 84637 topic_id: 16975 reply_id: 63671[/import]

oh that will be wonderful… I know of ways to make it work but requires c extensions, pure lua code that runs in CoronaSDK sandbox will be so awesome.

Each day is such a learning…

My way to manage this would be to have a list of the files that are included with the app and everytime a new file is added or removed, that list is updated, so I would just read that list and know the file that exist.

if it can be dynamically enumerated as you say, that will be wonderful…

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 16975 reply_id: 63681[/import]

Hey Danny,
Thank you for your help so far!

By any chance, did you get around to writing that example? I’d like to see it, if you don’t mind. :slight_smile:

Thanks again! [import]uid: 10211 topic_id: 16975 reply_id: 63852[/import]

I realize this isn’t a feature request, but I just wanted to add a +1!

It would be great to preload assets without having to hardcode them in. [import]uid: 49447 topic_id: 16975 reply_id: 64086[/import]

+1 one here.
Danny, have you been able to figure this out, or any other way to read the contents of documents directory ?
Thanks [import]uid: 80100 topic_id: 16975 reply_id: 89874[/import]