I made a test-code to understand LUA in the first post. After Dinsdale's post I changed my test-code in:
x = 0 -- Declaring x outside of the if statements will ensure that it exists.
commandArray = {}
if (devicechanged['RemoteWK2'] == "Off") then -- make x=1
print(' Switch is Off')...
I mean the loop of the luaprogram ..
After "return commandArray" the program starts again and make x=0, while I gave x=1 in the If-Next statement..
So how keep x=1 in the whole program??
Hi Dinsdale,
Thanks for your reply.
I have tried this. But when I give x the value 1 by pressing RemoteWK2 = Off, the loop makes x = 0 again. It seems the loop is not between "commandArray and return commandArray.
What I want is that I give the variable (x) a value and the variable (x) remains...
"EditMode On"
commandArray = {}
if (devicechanged['RemoteWK2'] == "Off") then
print(' Switch is Off')
x = 1
print(' X = : ' .. x .. ' ');
end
if (devicechanged['RemoteWK2'] == "On") then
print('Switch is On')
print(' X = : ' .. x .. ' ');
end...
Standard is a variable a global variable. But when I call a variable in an other "IF-THEN" Statement the variable is NIL.
I give the variable x "1"when the switch is pressed Off ( in the first IF-THEN).
In the second IF-THEN, I call the variable x when the switch is pressed On. --> The error...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.