honeylisp/game/tiles.fnl

20 lines
388 B
Fennel

(local util (require :lib.util))
(local lume (require :lib.lume))
(fn loadtiles []
(lume.map
(util.readjson "game/tiles.json")
#($1:fromhex)))
(fn savetiles [tiles]
(util.writejson
"game/tiles.json"
(lume.map tiles #($1:tohex))))
(fn appendtiles [tiles org]
(each [_ tile (ipairs tiles)]
(org:append [:bytes tile])))
{: loadtiles : savetiles : appendtiles}