Well I have a table as follows:
{
Number: 15007 Name: "Variance" Value: 35
}
Before I used a txt format that was like this:
15007,Variance,35
The code in C was something like this:
void read_names(void) {
struct st *table;
int var = 0;
const char *str = NULL;
table->number = var;
table->name = str;
table->value = var;
return;
}
I want to change to the moon now, I could use libconfig, but I've used it once and it's very limited, an example in lib if I were to do the above table:
void read_names(void) {
struct st *table;
int var = 0;
const char *str = NULL;
config_setting_t *names = .........
table->number = config_setting_lookup_int(names, "Number", &var);
table->name = config_setting_lookup_string(names, "Name", &str);
table->value = config_setting_lookup_int(names, "Value", &var);
return;
}
In this way I would be able to read the table that I posted at the beginning of the topic.
But I want to use the moon, which I want to know how I use the same form of the lib and allow me to use integers and string in the names Number, Name and Value, for example:
table->number = função_lua(L, "Number", &var);
If writing can not be that way, you should note that it was just an example.