PDA

View Full Version : GAC.Request results into list



snotneus
March 2nd, 2011, 12:42 PM
Hi,

I have been trying for days now, but I cannot find a way to get the results from a GAC request into a list in lua.
When I execute a gacAlbums:Request() for all available Albums, I can see that my looping, containing a button with text {MP.gacAlbums.Items[<LoopIndex>].Name} is filled with the names of the available Albums.

In lua file (attached to the CCF), I want to fill a list with the names of the Albums I am interested in.
So, something like:

myAlbums = {};
myIndex = 1;
repeat
myAlbums[myIndex] = NetRemote.GetVariable('MP.gacPrefetchAlbums.Items[<LoopIndex>].Name');
myIndex = myIndex + 1;
until NetRemote.GetVariable('MP.gacPrefetchAlbums.Items[<LoopIndex>].Name') == nil;

How can I go through the GAC loop within lua to get all the found Albums?
How can I set the <LoopIndex> to increase from lua?

Could someone here point me to a solution for this problem?

Thanks.

tmorten
March 6th, 2011, 08:32 AM
<LoopIndex> is just a numeric iterator, so putting a numeric iterator into a string would look something like this:

myAlbums[myIndex] = NetRemote.GetVariable('MP.gacPrefetchAlbums.Items['..myIndex..'].Name');

Cheers,
Tim

snotneus
March 6th, 2011, 09:10 AM
Tim,

Ah, that easy!

Thanks.