本文整理汇总了C++中SquirrelObject::Exists方法的典型用法代码示例。如果您正苦于以下问题:C++ SquirrelObject::Exists方法的具体用法?C++ SquirrelObject::Exists怎么用?C++ SquirrelObject::Exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SquirrelObject
的用法示例。
在下文中一共展示了SquirrelObject::Exists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RegisterPlugin
////////////////////////////////////////////////////////////////////////////////
// register a script plugin (script-bound function)
////////////////////////////////////////////////////////////////////////////////
SQInteger RegisterPlugin(HSQUIRRELVM v)
{
// get squirrel object to register from stack
SquirrelObject o;
o.AttachToStackObject(2);
// first verify that there is a member function to retrieve the plugin info
if (!o.Exists("GetPluginInfo"))
return sq_throwerror(v, "Not a script plugin!");
// ask for its registration name
SqPlus::SquirrelFunction<PluginInfo&> f(o, "GetPluginInfo");
PluginInfo& info = f();
wxString s = info.name;
// look if a script plugin with the same name already exists
ScriptPlugins::iterator it = s_ScriptPlugins.find(s);
if (it != s_ScriptPlugins.end())
{
// already exists; release the old one
s_ScriptPlugins.erase(it);
Manager::Get()->GetLogManager()->Log(_("Script plugin unregistered: ") + s);
}
// finally, register this script plugin
it = s_ScriptPlugins.insert(s_ScriptPlugins.end(), std::make_pair(s, o));
Manager::Get()->GetLogManager()->Log(_("Script plugin registered: ") + s);
Manager::Get()->GetScriptingManager()->RegisterScriptPlugin(s, CreateMenu(s));
// this function returns nothing on the squirrel stack
return 0;
}