string key = fqn;
set_top(key);
+ const bool top = !idx && key == s;
+
if ( ModHook* h = get_hook(key.c_str()) )
{
if ( !end(h->mod, nullptr, s, idx) )
ParseError("can't close %s", h->mod->get_name());
- else if ( !s_name.empty() )
- PluginManager::instantiate(h->api, h->mod, s_config, s_name.c_str());
+ else if (h->api && top)
+ {
+ if ( !s_name.empty() )
+ PluginManager::instantiate(h->api, h->mod, s_config, s_name.c_str());
+ else
+ PluginManager::instantiate(h->api, h->mod, s_config);
+ }
+ }
- else if ( !idx && h->api && (key == s) )
- PluginManager::instantiate(h->api, h->mod, s_config);
+ if ( top )
+ {
+ s_name.clear();
+ s_type.clear();
}
- s_name.clear();
- s_type.clear();
}
SO_PUBLIC bool set_bool(const char* fqn, bool b)