xexpanderx / Conky-themes

Conky themes
52 stars 19 forks source link

[Conky-Weather] Does not work for me. Only the circle appears. (however found a fix) #3

Closed K-mikaZ closed 3 years ago

K-mikaZ commented 3 years ago

INFO conky -v

conky 1.10.8

lua -v

Lua 5.3.3

locale

LANG=fr_FR.UTF-8 LANGUAGE= LC_CTYPE="fr_FR.UTF-8" LC_NUMERIC="fr_FR.UTF-8" LC_TIME="fr_FR.UTF-8" LC_COLLATE="fr_FR.UTF-8" LC_MONETARY="fr_FR.UTF-8" LC_MESSAGES="fr_FR.UTF-8" LC_PAPER="fr_FR.UTF-8" LC_NAME="fr_FR.UTF-8" LC_ADDRESS="fr_FR.UTF-8" LC_TELEPHONE="fr_FR.UTF-8" LC_MEASUREMENT="fr_FR.UTF-8" LC_IDENTIFICATION="fr_FR.UTF-8" LC_ALL=

Fixed with:

--[[ according to: https://stackoverflow.com/questions/10962085/lua-string-to-int#25552215 All numbers in Lua are floats (Lua 5.2 or less). If you truly want to convert to an "int" (or at least replicate this behavior). In which case you explicitly convert the string (or really, whatever it is) into a number, and then truncate the number like an (int) cast would do in Java. This still works in Lua 5.3, even thought Lua 5.3 has real integers, as math.floor() returns an integer, whereas an operator such as number // 1 will still return a float if number is a float. --]]

function ToInteger(number)
    return math.floor(tonumber(number) or error("Could not cast '" .. tostring(number) .. "' to number.'"))
end

temperature = ToInteger(string.format("%.0f", temperature))
xexpanderx commented 3 years ago

Hi thanks, which Conky do you refer to?

K-mikaZ commented 3 years ago

Hi thanks, which Conky do you refer to?

Sorry Conky-Weather

xexpanderx commented 3 years ago

Hey, I updated the scripts, could you retry?