Can someone tell me what's wrong with this?
for a, solar in pairs(data.raw.solar-panel) do
I keep getting "...unable to perform arithmetic on field 'solar' (a nil value)"
can't read solar panels?
Re: can't read solar panels?
The dash in the solar-panel makes this not a valid Lua identifier (Lua thinks it's a minus sign and tries arithmetic on it), you need to use a different syntax:withers wrote:for a, solar in pairs(data.raw.solar-panel) do
Code: Select all
for a, solar in pairs(data.raw["solar-panel"]) do
Re: can't read solar panels?
That did it. Thanks!daniel34 wrote:The dash in the solar-panel makes this not a valid Lua identifier (Lua thinks it's a minus sign and tries arithmetic on it), you need to use a different syntax:withers wrote:for a, solar in pairs(data.raw.solar-panel) doCode: Select all
for a, solar in pairs(data.raw["solar-panel"]) do