Missing Values
jkronaw opened this issue · comments
Jakob Kronawitter commented
Hello,
I have the following .toml
file:
restart = true
with a key named restart
that must have a boolean value. Also, it should be legal to omit this value from the config file, i.e. it is optional.
I use the following code to read the value:
toml_datum_t datum = toml_bool_in(root_table, "restart");
if (!datum.ok) {
printf("Key 'restart' is either missing or not a boolean.\n");
} else {
// do something
}
Is there a way to distinguish between a value missing in the config file or having the incorrect type? E.g. when the config file would look like this:
restart = "a string instead of a boolean"
Thanks a lot!
Jakob Kronawitter commented
See #60