Page 1 of 1

On FOR variable possible?

Posted: Thursday 21 January 2016 9:36
by SiSu82
Im doing some simple math in a lua and trying to set a switch ON for the calculated time

commandArray['Lamptest'] = 'On FOR testtime'

testtime is in this case a local variable in the lua script, whitch aint working, is it even possible?

Re: On FOR variable possible?

Posted: Thursday 21 January 2016 9:47
by jvdz
Assuming testtime is a variable in LUA this should work fine:

Code: Select all

commandArray['Lamptest'] = 'On FOR ' .. tostring(testtime)
Jos

Re: On FOR variable possible?

Posted: Thursday 21 January 2016 9:57
by SiSu82
jvdz wrote:Assuming testtime is a variable in LUA this should work fine:

Code: Select all

commandArray['Lamptest'] = 'On FOR ' .. tostring(testtime)
Jos
Thx alot Jos

Re: On FOR variable possible?

Posted: Thursday 21 January 2016 15:34
by havnegata
Trying to understand the concept of variable. Why is it an advantage to use a variable in your script instead of just f.ex 'On FOR 5' ?

Re: On FOR variable possible?

Posted: Thursday 21 January 2016 18:34
by SiSu82
havnegata wrote:Trying to understand the concept of variable. Why is it an advantage to use a variable in your script instead of just f.ex 'On FOR 5' ?
Because im doing some math in the LUA script depending on how cold it is outside, whitch makes me wanna put a switch on for X min.

On FOR xxx Minutes would ofc work but better to use the calculated value instead.

Re: On FOR variable possible?

Posted: Thursday 21 January 2016 18:40
by havnegata
Thanks for the reply, I'm beginning to understand, but can you please post the code, that way it's possible to get a greater understanding :-)

Re: On FOR variable possible?

Posted: Friday 22 January 2016 16:06
by SiSu82
havnegata wrote:Thanks for the reply, I'm beginning to understand, but can you please post the code, that way it's possible to get a greater understanding :-)
Will post it later this weekend, atm im doing some small changes to the code =)

Re: On FOR variable possible?

Posted: Sunday 24 January 2016 22:37
by havnegata
Thanks, awaiting :-)

Sent fra min Nexus 7 via Tapatalk