NimYAML/doc/snippets/quickstart/05/00-code.nim

13 lines
309 B
Nim
Raw Normal View History

import yaml, streams
2016-10-08 16:38:27 +00:00
type Mob = object
level, experience: int32
drops: seq[string]
setTagUri(Mob, "!Mob")
setTagUri(seq[string], "!Drops")
var mob = Mob(level: 42, experience: 1800, drops:
@["Sword of Mob Slaying"])
var s = newFileStream("out.yaml", fmWrite)
dump(mob, s, tagStyle = tsAll)
2016-10-08 16:38:27 +00:00
s.close()