Well do you need a concept or advise on actual C code? Well i started in lua not long ago. So i took a look in the official lua users wiki and tutorials about the concepts you need for this problem.
On the overview page it even tells you which concepts are important. Namely: Loops, Array, Conditions. I would also look into string manipulation.
Then look at the problem and go step by step. First you get a string and the number of temperatures. So find the nth temperature in the string (loop, string manipulation). Make sure it is number by now. Look at its delta from 0. Find a way to save that (variables) and compare it to the next case.... and so on.
Just break a problem down into small steps. Also it helped me to print alot of my variables and steps in between to control the returned values....Hope this helps a little bit