Page 1 of 1

Simple Lua on/off

Posted: Thursday 21 January 2016 22:50
by Danny94
So, decided to give Lua a look.. Got stuck allready...
I want to learn it, so i start with the basics: Turn a light of..... Sigh

Code: Select all

commandArray = {}
 if (devicechanged['Dressoir Rechts'] == 'Off') then
      commandArray['Dressoir Links']='Off'

 end
 return commandArray
Saved it as UTF-8, uploaded it to scripts/lua/ folder...
Looks quite simple but something is wrong..

Re: Simple Lua on/off

Posted: Friday 22 January 2016 2:20
by nayr
what is the name of the file? it has to be like: scripts/lua/script_device_dressoirrechts.lua if you want to catch devicechanged.

Re: Simple Lua on/off

Posted: Friday 22 January 2016 19:06
by Danny94
That did it! Thanks!
Are there rules for what filename you have to use?

Re: Simple Lua on/off

Posted: Friday 22 January 2016 19:21
by nayr
read the demo lua scripts.

Re: Simple Lua on/off

Posted: Friday 22 January 2016 19:52
by Danny94
Oh! Didn't realize that part talked about filename!

Thanks again, My Lua journey starts!