PDA

View Full Version : Specify a loop index start point?



VicVonDoom
May 24th, 2009, 08:49 AM
i've got a load of info from an rss feed in nr.
they start as..

{BeMoreCarefull\RSS\GBPExchangeRate\ItemList.Value s_1_Description}
the end point can vary.

I've been using this...

{BeMoreCarefull\RSS\GBPExchangeRate\ItemList.Value s_<LoopIndex>_Description}
to display them on a frame called "GBPFrame"

Can i specify a start point for the <LoopIndex> with lua


The plan is have a button set a variable to whatever number then the loopindex read this variable and start its looping there...

Is it Possible??? (basically a page down thingymabob)

Rob H
May 24th, 2009, 09:47 AM
No, you can't do exactly this using Lua, however you can use the ListManager to do this sort of thing. The the Lua Library reference in NRD's help, and possibly also the comments in ListManager.lua

VicVonDoom
May 24th, 2009, 04:00 PM
I've spent all afternoon trying to get this working to no avail...

Rob, could you have a look at this and tell me where i'm going wrong?!

Rob H
May 24th, 2009, 07:59 PM
I'll try to take a look at this tomorrow - remind me just in case :)

VicVonDoom
May 25th, 2009, 08:55 AM
bumpity bump bump
any news old chap?

Rob H
May 25th, 2009, 09:34 AM
Here you go, you'll have to edit the Lua to adjust the computer name from Drusilla back to BeMoreCarefull.

This example is a bit more complex than it normally would be since we're dealing with data in NetRemote variables rather than a Lua table which is what ListManager was originally intended for, hence the jiggery-pokery in the overridden methods OnGetItem and OnGetItemCount.

OnGetItemCount could be improved.

Also, because we're dealing with data coming from DeviceManager I had to use DM.RegisterUpdater to create the ListManager at the appropriate time.

VicVonDoom
May 25th, 2009, 12:31 PM
Blimey!
Thanks very much! Works perfect for my needs and also gives me a starting point for my other RSS feeds such as "how long will you be sat on the M25 for today?" etc...
Next pints on me!!

Rob H
May 25th, 2009, 03:00 PM
You're welcome