Editing a lua file for the rainmeter skin "Do you need a jacket" getting the error in the title for this code
--[[ Given the current temperature, return the appropriate
string for the main string meter ]]
local function getMainString( temp )
local negation = (temp > Settings.Ss_Limit) and " don't" or ""
local summerwear = (temp < Settings.Ss_Limit) and (temp > Settings.Vest_Limit) and "shirt and shorts"
local innerwear = (temp < Settings.Vest_Limit) and (temp > Settings.Jacket_Limit) and "vest"
local southerwear = (temp < Settings.Jacket_Limit) and (temp > Settings.Coat_Limit) and "jacket"
local outerwear = (temp < Settings.Coat_Limit) and "coat"
return string.format("You%s need a %s", negation, (summerwear or innerwear or southerwear or outerwear))
end
It is supposed to give the correct clothing based on temperature. I have tried with different locations for temperature variation, and the only time i get the error is when the temperature is over Ss_limit. I dont have much coding experience so thank you in advance
When
temp
is larger thanSettings.Ss_Limit
, or equals any of theSettings.*_Limit
, allsummerwear
,innerwear
,southerwear
andcoatwear
will befalse
. This make(summerwear or innerwear or southerwear or outerwear)
to befalse
(a boolean) instead of a string which is causing the error.Possible fix: