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

17
LINES

< > BotCompany Repo | #134 // clockplus

Lua code

grab("#137")
get("#135")

function clockplus(clock, plus)
  local h, m = unpack(split(clock, ":"))
  log(h, ":", m)
  if h == nil then error("bad format") end
  h=tonumber(h)
  m=tonumber(m)
  m = m+plus
  if m>=60 then m=m-60 h=h+1 end
  if h>=24 then h=0 end
  
  -- have to use 2 lines because of LuaJ error localisation bug
  local result = clockformat(h, m)
  return result
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: 1097 / 520
Referenced in: [show references]