• Announcement: Lua.org now officially recommends this forum as a meeting place for the Lua community

Search results

  1. B

    using global Variable in IF-THEN

    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')...
  2. B

    using global Variable in IF-THEN

    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??
  3. B

    using global Variable in IF-THEN

    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...
  4. B

    using global Variable in IF-THEN

    "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...
  5. B

    using global Variable in IF-THEN

    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...
Top