cktan / tomlc99

TOML C library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing Values

jkronaw opened this issue · comments

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!