honeylisp/util.fnl

10 lines
281 B
Fennel

(fn table.clone [tbl]
(let [newtbl {}]
(each [k v (pairs tbl)]
(tset newtbl k v))
newtbl))
(fn string.fromhex [str]
(str:gsub ".." (fn [cc] (string.char (tonumber cc 16)))))
(fn string.tohex [str]
(str:gsub "." (fn [c] (string.format "%02X" (string.byte c)))))