(15.01.2024, 10:26)admin Wrote: Do you have snowsum = 0 before the repeat loop? What is the exact error that you get?
User script:83: attempt to index field 'snow' (a nil value) stack traceback:
snowsum = 0 for i = 1, 24 do hourly = data.hourly[i] if hourly.snow then snowsum = snowsum + (hourly.snow['1h'] or 0) end end
(15.01.2024, 10:32)admin Wrote: Try this: Code:snowsum = 0 for i = 1, 24 do hourly = data.hourly[i] if hourly.snow then snowsum = snowsum + (hourly.snow['1h'] or 0) end end