This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

openweather ONE call API
#20
(15.01.2024, 09:14)admin Wrote: Use this:
Code:
data.hourly[i].snow['1h']

Many thanks! This idea work, but I have a problem in the case of The value doesn’t exist because there is no snow forecasted = nil.

I tried this one:

Code:
repeat
    i=i+1
        if data.hourly[i].snow['1h'] == nil
        then
        data.hourly[i].snow['1h'] = 0
        end
    log(data.hourly[i].snow['1h'])
    snowsum = data.hourly[i].snow['1h'] + snowsum
until
    i>24

but it doesn’t work. 

Code:
User script:83: attempt to index field 'snow' (a nil value)
stack traceback:

Do you have an idea please? 

Many thanks!
Reply


Messages In This Thread
openweather ONE call API - by pioneersteffen - 17.10.2021, 11:35
RE: openweather ONE call API - by admin - 18.10.2021, 06:07
RE: openweather ONE call API - by JRP - 19.10.2021, 10:16
RE: openweather ONE call API - by admin - 21.10.2021, 06:22
RE: openweather ONE call API - by admin - 22.10.2021, 06:43
RE: openweather ONE call API - by admin - 25.10.2021, 06:50
RE: openweather ONE call API - by AlexLV - 30.10.2021, 20:03
RE: openweather ONE call API - by AlexLV - 31.10.2021, 14:30
RE: openweather ONE call API - by admin - 15.01.2024, 09:14
RE: openweather ONE call API - by pioneersteffen - 15.01.2024, 10:23
RE: openweather ONE call API - by admin - 15.01.2024, 10:26
RE: openweather ONE call API - by admin - 15.01.2024, 10:32

Forum Jump: