getValues() Pickerwheel Values not Recognized by '==' Operator

I am trying to create an alarm clock that is set by the user using a pickerwheel widget. After the user sets the alarm time in the pickerwheel, a clock continuously checks whether the alarm time is equal to the actual time once per second using the ‘==’ operator. The problem is that the ‘==’ operator does not recognize that the alarm time (extracted  from pickerwheel using the the getValues function) is the same as the actual time, when they are in fact equal. The following is a simplified version of my code which illustrates the problem:

local alarmTime = {}
local actualTime = {10, 30} – actual time is 10:30

–after setting picker wheel column one to “10” and column two to “30”:
local pickerValues = pickerWheel:getValues()
local alarmTime[1] = pickerValues[1].value
local alarmTime[2] = pickerValues[2].value

print( actualTime[1], actualTime[2] )

print( alarmTime[1], alarmTime[2] )

print( actualTime[1] == alarmTime[1]  ) – returns true if values are equal and false if they are not
print( actualTime[2] == alarmTime[2]  ) – returns true if values are equal and false if they are not

Output:

10

30

10

30

false

false

The above code returns “false” twice in the output window, indicating the values are not the same even though they print the same.

Any help or feedback in addressing this problem would be much appreciated!

I was able to find the solution to my problem. Apparently, the getValues() function returns values of type string and my actualTime value was of type number. As a result, my alarmTime and actualTime values did not equal each other when comparing them using the ‘==’ operator because the were of different types. I solved this problem by using the tostring() command to convert the actualTime to type string when comparing the alarmTime and actualTime values. After doing this, print( actualTime[1] == alarmTime[1]  ) and print( alarmTime[1], alarmTime[2] ) both return a “true” result in the output window.

I was able to find the solution to my problem. Apparently, the getValues() function returns values of type string and my actualTime value was of type number. As a result, my alarmTime and actualTime values did not equal each other when comparing them using the ‘==’ operator because the were of different types. I solved this problem by using the tostring() command to convert the actualTime to type string when comparing the alarmTime and actualTime values. After doing this, print( actualTime[1] == alarmTime[1]  ) and print( alarmTime[1], alarmTime[2] ) both return a “true” result in the output window.