function main (userId) val1 = GetReg(1) or 0 -- if GetReg is nil, then it will be equal to 0 TRACE("val1 " ..tostring(val1)) val2 = GetReg("temperature") TRACE("val2 " ..tostring(val2)) val2_filtered = (val2 or 0) -- if val2 is nil, then it will be equal to 0 too. TRACE("val2_filtered " ..tostring(val2_filtered)) sum = val1 + val2_filtered TRACE(sum) end