Updating Helm display in Lua

If you are programming a sequence of actions in Lua you will soon realise that the Helm user interface does not update until the script is finished. That makes sense under most circumstances for reasons of efficiency. However, if you do want to make lights flash on and off for example you need and extra Lua command helm.idle(). Here’s an example of how to use that.

Our panel

media_1450263961916.png

Very simple. A set of indicators which we will try to change colours as the script runs. And two buttons with scripts that illustrate the difference.

Script that does not update

media_1450264115816.png

This script changes the CurrentPicture parameter of the Indicators at intervals. But you see nothing happening. ( By the way, note the “Indicator_*” notation. You can use wildcards like this to drive several objects at once ).

Script that works

media_1450264276715.png

Now we’ve added helm.idle after each change which causes Helm to update the display to reflect the new values.

Success!

media_1450264383136.png

And now we have the desired colour sequence effect. You can download the sample panel here to see all this in action.