1 local bench
= require
"bench"
2 local clock = bench
.clock
6 local function time_return(begun
, ...)
7 local duration
= clock() - begun
11 function aux
.time(f
, ...)
13 return time_return(begun
, f(...))
17 print(string.format(...))
20 function aux
.toboolean(s
)
21 return tostring(s
):match("^[1TtYy]") and true or false
24 function aux
.optenv(k
, def
)
25 local s
= os
.getenv(k
)
27 return (s
and #s
> 0 and s
) or def