What I would really like is a structure that would give me sentences like:
Code: Select all
local function getMainString( temp, rain ) local negation = (temp > JACKET_LIMIT) and " don't" or "" local outerwear = (temp < COAT_LIMIT) and "coat" or "jacket" local unbrella = (rain=="Yes") and "An umbrella would be useful." or "" return string.format("You%s need a %s. %s", negation, outerwear, unbrella) end
"You don't need a jacket, but an umbrella would be useful"
"You need a jacket and an umbrella today"
"You need need a coat and an umbrella - YUCK!"
Basically the local <varname> = (condition) and "positive result" or "negative result" seems too limiting for what I need. I need a better structure so I can do more checks for temp and rain.
I appreciate any help real coders can provide!