Watchmaker Wiki

The ultimate watch maker for Android Wear!

User Tools

Site Tools


tips:heatindex

This is an old revision of the document!


Table of Contents

Examples

Fahrenheit

 Text:  ({wt}<80 and {wt} or {wh}<40 and {wt} or math.floor(-42.379+(2.04901523*{wt})+(10.14333127*{wh})+(-0.22475541*{wt}*{wh})+(-.00683783*({wt}^2))+(-.05481717*({wh}^2))+(.00122874*{wh}*({wt}^2))+(.00085282*{wt}*({wh}^2))+(-.00000199*({wt}^2)*({wh}^2))+.5)) .. "ᵒF"

Explanation

Yeah right… you expect me to explain all that?!? Okay, okay, I'll try my best.

The example shows the text field of a text object displaying Heat Index in the following format: 129ᵒF

This is done by first calculating heat index using the current temperature ({wt}) and the current humidity ({wh}).

Once we've done the calculation, we need to concatenate the “ᵒF” or “ᵒC” to the formula. To do this, we need to fool LUA into thinking that we're dealing exclusively with strings (for some stupid reason… LUA isn't the smartest of languages sometimes). We do this by encapsulating the entire formula within a single set of parentheses. So, yes, the first and last parentheses are required. Then, we simply add the concatenation symbol “..” followed by the desired display in quotes (“ᵒF” or even just “ᵒ”). Just be sure to include a single space on either side of the concatenation symbol.

I'm sure some of you are wondering why I didn't include a Celsius formula. The reason is simple. I couldn't find a formula for Celsius! I'm guessing that nobody wanted to duplicate that madness for another temperature scale, so they just do it in Fahrenheit, and convert the result to Celsius using the standard Fahrenheit to Celsius conversion formula of (F-32)*5/9.

tips/heatindex.1422312647.txt.gz · Last modified: 2015/01/26 22:50 by jt3