Quasar
Moderator

Posts: 4615
Registered: 08-00 |
Gez said:
Couldn't they all be declared in one of the core EDF files, so that libconfuse knows about them? That's what ZDoom does (check the code for the Actor class).
Would require creating the cfg_opt_t at runtime, which is certainly not impossible. Really what I should do is add support for this at the library level, within libConfuse (something such as cfg_appendopts or cfg_dynamicopt, etc.), since it's already semi-capable of dealing with it.
This would allow libConfuse to become sort of introspective, as it would be defining the syntax to parse a language within a language which it parses.
It would require declaring the types as well as the names, however. Basically what you'd end up with would be very similar to the cfg_opt_t in C:
code:
cfg_opt_t opts[] =
{
CFG_STR("blah", "", CFGF_NONE),
CFG_INT("foo", 0, CFGF_LIST),
CFG_END()
};
In libConfuse "metaprogramming" this would end up probably looking like:
code:
entity blarg
{
option blah, string, "", NONE
option foo, int, 0, LIST
}
An interesting idea. The properties declared as such could be metatabled under the same keys and become accessible to anything in the game engine... ::drools::
|