The example that I added to my first post actually works.
My purpose: I want to create a command in one LUA script, and put it in a user variable.
Another LUA time-drive script can then pick up this command and execute it for a number of iterations.
A second user variable contains the required number.
Reason behind this: I have one sript that I execute when going to bed at night, it is invoked by a button on my remote control..
The script will turn off all the lights in my living room by invoking the "all lights off" scene.
About half of these lights are controlled via RF (KAKU), and since the RF band is quite busy here it happens occasionally that some commands are "missed". This results in lights staying on, if I don't notice they will still be on in the morning. Bot very good for the WAF..
What I have done to fix this is: the "turnoff" script will put a command in a user variable, and set the required frequency in another user variable. It also invokes the "all lights off" script as usual.
The other time-driven script will notice the integer in the user variable. It will decrement that by one, and execute the command. Repeats until the integer is zero.
This way the lights are usually turned off by the first command, but for safety will be turned off again two more times with one minute intervals.
Sounds complicated, but it really isn't.
Because I put the command in the user variable, I will be able to re-use this setup for other purposes. Not sure if any.