Array of strings and their indexing in lua
Posted: Thursday 20 October 2016 22:50
All,
I'm rather new to lua, but not too programming.
To loop through heating zones in trying to put their names in an array that I can then iterate over to do something for each of them. Not knowing the syntax I read lua.org to try to learn the language.
So i try something like:
and tried to index it in a for loop. I at that point realised that table.getn(names) does not work. Also names[0] or names[1] are nil.
What am I missing?
Is there a better reference for lua as interpreted in domoticz?
Cheers
Fred
I'm rather new to lua, but not too programming.
To loop through heating zones in trying to put their names in an array that I can then iterate over to do something for each of them. Not knowing the syntax I read lua.org to try to learn the language.
So i try something like:
Code: Select all
local names={"kitchen", "bedroom"}
What am I missing?
Is there a better reference for lua as interpreted in domoticz?
Cheers
Fred