Skip to content

Instantly share code, notes, and snippets.

@flyinghyrax
Created March 25, 2015 23:00
Show Gist options
  • Save flyinghyrax/ecc179a2488693e3f93f to your computer and use it in GitHub Desktop.
Save flyinghyrax/ecc179a2488693e3f93f to your computer and use it in GitHub Desktop.
--[[
Add a table like this to the script, near the beginning of the file.
The numbers on the left are the max temps for the strings on the right;
i.e. if the temperature is between 0 and 20 degrees then the phrase is
"You need a big coat". These numbers are just examples and are for
Fahrenheit temperatures; they should be changed for your preferences and
to reasonable Celsius values if you use Celsius temps
]]
local Main_String_Options = {
100 = "You need a bathing suit",
90 = "You need a shirt (pants optional)",
70 = "You need a flannel",
60 = "You need a windbreaker",
50 = "You need a jacket",
40 = "You need a coat",
20 = "You need a big coat",
0 = "You need to stay inside",
}
--[[
This should *replace* the original getMainString function in the script
(from around line 106 or so). If you pass this function a temperature, then
it loops through the table from above until it finds a phrase with a maximum
temperature less than that and returns that string.
]]
local function getMainString( temp )
for i, v in ipairs(Main_String_Options) do
if temp < i then
return v
end
end
-- this gets returned if the temp was higher than any temperature from
-- the table (it was really hot)
return "Please just stay inside"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment