roriscrave
Advanced OT User
- Joined
- Dec 7, 2011
- Messages
- 1,210
- Solutions
- 35
- Reaction score
- 206
I need to be able to get the table value, which is bigger and closer to the "timeNow"
the timeNow print the hours and minutes, exemple if i use print(timeNow), it print like this:
in this case, i need to get "14:30", because is the value bigger and closer to the timeNow
remembering that if timeNow is "22:00" hours for example, i need to get the next value that would be "00:10"
the timeNow print the hours and minutes, exemple if i use print(timeNow), it print like this:
Code:
13:55
remembering that if timeNow is "22:00" hours for example, i need to get the next value that would be "00:10"
LUA:
local times = {
[1] = {"00:10", "04:30", "14:30", "16:30"},
[2] = {"02:30", "06:00", "10:30", "18:00"}
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local timeNow = tostring(os.date("%X")):sub(1, 5)
--need to get the table value, which is bigger and closer to the "timeNow"
--remembering that if timeNow is "22:00" hours for example, i need to get the next value that would be "00:10"
return true
end
Last edited: