11Split = function (szFullString ,szSeprator )
2- local nFindStartIndex = 1
3- local nSplitIndex = 1
4- local nSplitArray = {}
5- while true do
6- local nFindLastIndex = string.find (szFullString ,szSeprator ,nFindStartIndex )
7- if not nFindLastIndex then
8- nSplitArray [nSplitIndex ] = string.sub (szFullString ,nFindStartIndex ,string.len (szFullString ))
9- break
10- end
11- nSplitArray [nSplitIndex ] = string.sub (szFullString ,nFindStartIndex ,nFindLastIndex - 1 )
12- nFindStartIndex = nFindLastIndex + string.len (szSeprator )
13- nSplitIndex = nSplitIndex + 1
14- end
15- return nSplitArray
2+ local nFindStartIndex = 1
3+ local nSplitIndex = 1
4+ local nSplitArray = {}
5+ while true do
6+ local nFindLastIndex = string.find (szFullString ,szSeprator ,nFindStartIndex )
7+ if not nFindLastIndex then
8+ nSplitArray [nSplitIndex ] = string.sub (szFullString ,nFindStartIndex ,string.len (szFullString ))
9+ break
10+ end
11+ nSplitArray [nSplitIndex ] = string.sub (szFullString ,nFindStartIndex ,nFindLastIndex - 1 )
12+ nFindStartIndex = nFindLastIndex + string.len (szSeprator )
13+ nSplitIndex = nSplitIndex + 1
14+ end
15+ return nSplitArray
1616end
1717
1818formatTime = function ( timeStr )
19- local splited = Split (timeStr , " :" )
20- local h = splited [1 ]
21- local m = splited [2 ]
22- return tonumber (h ), tonumber (m )
19+ local splited = Split (timeStr , " :" )
20+ local h = splited [1 ]
21+ local m = splited [2 ]
22+ return tonumber (h ), tonumber (m )
2323end
2424
2525getRemainTime = function (timeStr )
26- local h1 , m1 = formatTime (timeStr )
27- local curTime = os.date (" *t" , os.time ())
28- local curH = curTime .hour
29- local curM = curTime .min
26+ local h1 , m1 = formatTime (timeStr )
27+ local curTime = os.date (" *t" , os.time ())
28+ local curH = curTime .hour
29+ local curM = curTime .min
3030
31- local remainH = h1 - curH
32- local remainM = m1 - curM
33- local totalRemainSeCond = remainH * 3600 + remainM * 60
34- return totalRemainSeCond
31+ local remainH = h1 - curH
32+ local remainM = m1 - curM
33+ local totalRemainSeCond = remainH * 3600 + remainM * 60
34+ return totalRemainSeCond
3535end
0 commit comments