dvo wrote:lua had to be fixed couse lua says simply take the time of the operation system ....instead of hour and minutes out of the variable tried many ways but don't understand lua script yet ..
Here is the fix of your last problem. If you want that on the alarm clock the text indicate not the current time, but what you've set to the alarm, you'll have to work with the TextClock.lua. This file takes the hour and minute of the operating system and you'll want instead to take the Time variable from the Arc.ini and work with it. To achieve this, just replace the
Code: Select all
hour = tonumber(os.date('%I'))
minute = tonumber(os.date('%M'))
lines of the lua file (Update() function), with the following ones:
Code: Select all
AlarmTime = SKIN:GetVariable('Time')
LenAlarmTime = string.find(AlarmTime, ':') - 1
hour = tonumber(string.sub(AlarmTime, 1, LenAlarmTime))
if hour > 12 then
hour = hour - 12
end
minute = tonumber(string.sub(AlarmTime, -2, -1))
In this code, the
AlarmTime = SKIN:GetVariable('Time') line gets the Time variable from the main ini file.
LenAlarmTime = string.find(AlarmTime, ':') - 1 determines the place of the character before the : (the last digit of the hour). You need this because the number of hours can have one or two digits and you have to know this to can read the hour.
The next step is to get from the alarmTime variable the number of hours and the number of minutes.
hour = tonumber(string.sub(AlarmTime, 1, LenAlarmTime)) determines the hour, copying from the AlarmTime variable everything from the first, until the LenAlarmTime character (one or two characters). Also
minute = tonumber(string.sub(AlarmTime, -2, -1)) copies the last two characters of AlarmTime. In both cases the copied characters are converted to numbers by the tonumber function.
The last thing you'll have to do, is to extract 12 from the number of hours, if this is greater then 12 (the lua script works only if the number of hours is below 12).
I left the rest of the TextClock.lua file untouched. It can use with no problems the hour and minute variables determined previously.
To be honest, I just believe this is a good solution, because I don't know Dutch at all, so I practically can't check. But I think it's a good solution. Please let me know if it indeed is.
Also note that with all this changes, you won't be able to use the TextClock.lua file into the TextClock.ini. If you want to use it, you'll have to recreate the initial TextClock.lua, name it for example TextClock2.lua and replace its name in the [MeasureTime] measure of the TextClock.ini.