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 comes with NIL..
Of course I can start before the first IF-THEN with x = 0.
But When x become 1 in the first IF-THEN, after the loop at the end x = 0 again. There is no error.. but x = always 0 now..
I want to see de value of x in the second IF-THEN when I press the ON button..
The program is just a sample for testing.
How to use a variable in the whole program and not only in the "If then"statement?.
example to determine the variable x
Thx
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 comes with NIL..
Of course I can start before the first IF-THEN with x = 0.
But When x become 1 in the first IF-THEN, after the loop at the end x = 0 again. There is no error.. but x = always 0 now..
I want to see de value of x in the second IF-THEN when I press the ON button..
The program is just a sample for testing.
How to use a variable in the whole program and not only in the "If then"statement?.
example to determine the variable x
Code:
Error code in log: Error: EventSystem: in test-lua: [string "commandArray = {}..."]:12: attempt to concatenate a nil value (global 'x')
Thx