Maybe you could help

, I have one small error:
2025-02-19 22:40:00.579 Error: EventSystem: in LCD Falownik Lua all: [string "commandArray = {} ..."]:4: bad argument #1 to 'pairs' (table expected, got nil)
2025-02-19 22:41:00.471 Error: EventSystem: in LCD Inverter Lua all: [string "commandArray = {} ..."]:4: bad argument #1 to 'pairs' (table expected, got nil)
2025-02-19 22:42:00.522 Error: EventSystem: in LCD Inverter Lua all: [string "commandArray = {} ..."]:4: bad argument #1 to 'pairs' (table expected, got nil)
2025-02-19 22:43:00.544 Error: EventSystem: in LCD Inverter Lua all: [string "commandArray = {} ..."]:4: bad argument #1 to 'pairs' (table expected, got nil)
What does he mean by pairs, table?
I've made a script to send data from the sensor to the ESP to the display. The script works, it displays what it is supposed to display on the display.
my script:
commandArray = {}
-- loop through all the changed devices
for deviceName,deviceValue in pairs(devicechanged) do
if (deviceName=='L123FW') then
commandArray['OpenURL']='http://192.168.0.113/control?cmd=LCD,1,1,'..tostring(deviceValue)..'_W'
end
if (deviceName=='L123FkWh') then
commandArray['OpenURL']='http://192.168.0.113/control?cmd=LCD,2,1,'..tostring(deviceValue)..'_kWh'
end
end
return commandArray
.
and this is the LUA script all instructions:
commandArray = {}
print ("All based event fired");
-- loop through all the devices
for deviceName,deviceValue in pairs(otherdevices) do
-- if (deviceName=='myDevice') then
-- if deviceValue == "On" then
-- print("Device is On")
-- elseif deviceValue == "Off" then
-- commandArray['a device name'] = "On"
-- commandArray['Scene:MyScene'] = "Off"
-- end
-- end
end
-- loop through all the variables
for variableName,variableValue in pairs(uservariables) do
-- if (variableName=='myVariable') then
-- if variableValue == 1 then
-- commandArray['a device name'] = "On"
-- commandArray['Group:My Group'] = "Off AFTER 30"
-- end
-- end
end
.