convert character to word

Hey guys…

I have a scene that tell us the weather in the morning… but I need to deal with temperature under 0 :wink:

local outsideTemp = luup.variable_get(TEMP_SID, "CurrentTemperature", 68)

my outsideTemp contain sometime something like “- 2” and I would need to convert the - to “moins” and convert + to “”

any idea…

This will do it…

local function translate (text)
    local lookup = {
        ["-"] = "moins ",
        ["+"] = " ",
    }
    return (text:gsub ("%W", lookup))
end

so that

print (translate "-42 +23")

gives you

moins 42  23

AK,

thanks… working fine :wink: