PDA

View Full Version : The button does not display



sonata31
December 16th, 2008, 09:51 AM
I have a button with 2 states
- default : the button is hidden
- state 1 : rule is lua code :

When the code is :


return (NetRemote.GetVariable("NR.processRunning") == "TV");

the button is displayed if NR.processRunning == "TV"

When the code is :


return (GetProcessName() == "TV");

with GetProcessName() defined in lua file :



function GetProcessName()
return (NetRemote.GetVariable("NR.processRunning"));
end;


the button is not displayed

Rob H
December 17th, 2008, 04:54 AM
That's pretty much expected - NR looks for calls to NetRemote.GetVariable in your Lua code and sets up a variable watch on the variable in question. In the second case there is no call to NetRemote.GetVariable so it doesn't know what to do with that state rule. Perhaps it should issue an error message in that case.

If we didn't do this then NR would periodically have to evaluate every single Lua state rule on every element which would be very time consuming.

If you really need to use a potentially complex Lua function in your state rule then you can include a reference in the Lua code to NetRemote.GetVariable('Utility.TimeSinceLastAction ') which will force NR to evaluate the state rule roughly every 250 mS.

sonata31
December 17th, 2008, 06:13 AM
That's pretty much expected - NR looks for calls to NetRemote.GetVariable in your Lua code and sets up a variable watch on the variable in question. In the second case there is no call to NetRemote.GetVariable so it doesn't know what to do with that state rule. Perhaps it should issue an error message in that case.

If we didn't do this then NR would periodically have to evaluate every single Lua state rule on every element which would be very time consuming.

If you really need to use a potentially complex Lua function in your state rule then you can include a reference in the Lua code to NetRemote.GetVariable('Utility.TimeSinceLastAction ') which will force NR to evaluate the state rule roughly every 250 mS.

Thank You for your response