Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #134 // clockplus

Lua code

1  
grab("#137")
2  
get("#135")
3  
4  
function clockplus(clock, plus)
5  
  local h, m = unpack(split(clock, ":"))
6  
  log(h, ":", m)
7  
  if h == nil then error("bad format") end
8  
  h=tonumber(h)
9  
  m=tonumber(m)
10  
  m = m+plus
11  
  if m>=60 then m=m-60 h=h+1 end
12  
  if h>=24 then h=0 end
13  
  
14  
  -- have to use 2 lines because of LuaJ error localisation bug
15  
  local result = clockformat(h, m)
16  
  return result
17  
end

test run  test run with input  download  show line numbers   

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Image recognition results

Recognizer Recognition Result Visualize Recalc
#308 398 [visualize]

Snippet ID: #134
Snippet name: clockplus
Eternal ID of this version: #134/1
Text MD5: 5b953694c22c62c6793690c5a3ce906d
Author: stefan
Category:
Type: Lua code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2014-01-11 06:56:48
Source code size: 398 bytes / 17 lines
Pitched / IR pitched: Yes / Yes
Views / Downloads: 1099 / 521
Referenced in: [show references]