import std.exception; import gfx.decl.sdlang.parser; auto root = parseSource(` foo 1 "a" 2 "b" foo 3 "c" 4 "d" // getTagValues considers this to override the first foo `); assert( root.getTagValues("foo") == [Value(3), Value("c"), Value(4), Value("d")] ); // Tag not found // If you'd prefer an exception, use `expectTag.values` instead. assert( root.getTagValues("doesnt-exist") is null ); assert( root.getTagValues("doesnt-exist", [ Value(999), Value("Not found") ]) == [ Value(999), Value("Not found") ] );
Lookup a child tag by name, and retrieve all values from it.
This just like using getTag().values, except if the tag isn't found, it safely returns null (or an optional array of default values) instead of a dereferencing null error.
Note that, unlike getValue, this doesn't discriminate by the value's type. It simply returns all values of a single tag as a Value[].
If you'd prefer an exception thrown when the tag isn't found, use expectTag.values instead.