I'am trying to learn lua, but failing in my normal rate (everytime)
I've tried to get my normal status blocky to lua, but its telling me tht I dont know what I'am doing.
Whats wrong here ??
Code: Select all
commandArray = {}
if (devicechanged['Virt_Dusk'] == 'On' and
otherdevices['Virt_Dark'] == 'Off' and
otherdevices['Hemma'] == 'On' and
otherdevices['Virt_Sleep'] == 'Off' and
otherdevices['Virt_TV'] == 'Off' and
otherdevices['Virt_Manuell'] == 'Off') then
commandArray['Scene:Dusk']='On'
print('Scene Dusk')
end
if (devicechanged['Virt_Dusk'] == 'Off' and
otherdevices['Virt_Dark'] == 'On' and
otherdevices['Hemma'] == 'On' and
otherdevices['Virt_Sleep'] == 'Off' and
otherdevices['Virt_TV'] == 'Off' and
otherdevices['Virt_Manuell'] == 'Off') then
commandArray['Scene:Dark']='On'
print('Scene Dark')
end
if (devicechanged['Virt_Dag'] == 'On' and
otherdevices['Hemma'] == 'On' ) then
commandArray['Scene:Day']='On'
print('Scene Day')
end
return commandArray
Error: EventSystem: in LUA Hemma Vanligt: [string "commandArray = {} ..."]:2: attempt to index global 'devicechanged' (a nil value)
I'am even failing on a even simpler script.
Code: Select all
commandArray = {}
if (devicechanged['Idiot'] == 'On') then
print ('IDIOT=ON')
end
if (devicechanged['Idiot'] == 'Off') then
print ('IDIOT=Off')
end
return commandArray
What are I'am doing wrong here, besides not understanding what Domo are trying to tell me.
Regards Magnus Svensson