View Full Version : lua code in button name?

December 19th, 2008, 09:12 AM
I want to display different text on the button depending on some variables.

example (not real code, just to show what I want):

if MP.GACL.Items[<LoopIndex>].SubItemCount > 0 then
{MP.GACL.Items[<LoopIndex>].Artist} - {MP.GACL.Items[<LoopIndex>].Name}

In other words:
Can I put lua code in the element name of the button to evaluate what to print on the button?

I guess I could put variabelwatches on all the MP.GACL.Items[<LoopIndex>].Name variables but this seems to be abit drastic?!?

Rob H
December 19th, 2008, 10:28 AM
No, that's not possible I'm afraid.

You'll have to use a NetRemote variable for the button name and set that accordingly in Lua code.

Another possibility is to use two buttons - one with each sort of label, and use a state rule to decide which one to display.

December 19th, 2008, 11:46 AM
I want it to be as fast as possible on my ppc, which of the approaches do you think is best?

Rob H
December 19th, 2008, 11:57 AM
I'd go for the two buttons with state rules in that case, that's almost certainly going to be faster

December 19th, 2008, 11:59 AM
Thanks for your help :)