lfeutre / lmud

An Erlang and LFE MUD/MUSH Server.
Other
23 stars 9 forks source link

Add support for parsing Twine JSON files #67

Open oubiwann opened 2 years ago

oubiwann commented 2 years ago

Part of:

Example basic parsing:

lfe> (set `#(ok ,json-bytes) (file:read_file "priv/twine/lobby-game.json"))
lfe> (set data (jsx:decode json-bytes '()))
lfe> (list-comp ((<- p (mref data #"passages"))) (mref p #"name"))
(#"Lobby"
 #"Create Character"
 #"Join Game"
 #"Delete Character"
 #"Manage Account"
 #"Delete Account")

Tasks:

oubiwann commented 2 years ago

With the above support, the following now works:

(clj:-> "priv/twine/lobby-game.json" 
        (lmud-twine:read) 
        (lmud-twine:passages))

which gives:

(#"Lobby"
 #"Create Character"
 #"Join Game"
 #"Delete Character"
 #"Manage Account"
 #"Delete Account")