Can key have dots in its name using libconfig library

35 views Asked by At

Can I have key name as "a.b.c" in the cfg file read by libconfig library?

a.b.c = (
   { title = "t1"; value = true;},
   { title = "t2"; value = false;}
);

As per the documentation, it does not look like it is supported but just wanted to confirm. Is there any way to solve it?

1

There are 1 answers

1
Emmanuel On

Yes, it's not supported to use dot notations like that.

If you would still want to access them as "a.b.c", you can use the nested groups:

a {
    b {
        c = (
            { title = "t1"; value = true; },
            { title = "t2"; value = false; }
        );
    }
}

or, if you want it at a singular level (flattened), then rename it to "abc" or "a_b_c" (replacing the . with _)