Posted: Thu Aug 11, 2016 9:01 pm Post subject: help me to add if statment to the code
I have 0 experience in LUA help me to add the 2nd code to its without errors please
Code:
{$lua}
[ENABLE]
myrecord = getAddressList().getMemoryRecordByDescription("whatever")
if mytimer == nil then
mytimer = createTimer(nil, false)
end
mytimer.Interval = 10
mytimer.OnTimer = function(timer)
myrecord.Active = not myrecord.Active
end
mytimer.Enabled = true
[DISABLE]
mytimer.Enabled = false
_____________________________
Code:
if myrecord.Active then
myrecord.Active = false
mytimer.Interval = 1000
else
myrecord.Active = true
mytimer.Interval = 10
end
Quote:
Zanzer say
No, you definitely wouldn't call sleep at all.
You'd use the timer itself to handle both enable/disable of the secondary script.
If you want different intervals, you can change them within the function too.
I want to merge both codes → to add different intervals,
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum