当前位置: 首页>>代码示例>>C++>>正文


C++ SquirrelObject::AttachToStackObject方法代码示例

本文整理汇总了C++中SquirrelObject::AttachToStackObject方法的典型用法代码示例。如果您正苦于以下问题:C++ SquirrelObject::AttachToStackObject方法的具体用法?C++ SquirrelObject::AttachToStackObject怎么用?C++ SquirrelObject::AttachToStackObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SquirrelObject的用法示例。


在下文中一共展示了SquirrelObject::AttachToStackObject方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Next

BOOL SquirrelObject::Next(SquirrelObject &key,SquirrelObject &val)
{
	if(SQ_SUCCEEDED(sq_next(m_Vm.GetVMPtr(),-2))) {
		key.AttachToStackObject(-2);
		val.AttachToStackObject(-1);
		sq_pop(m_Vm.GetVMPtr(),2);
		return TRUE;
	}
	return FALSE;
}
开发者ID:henryrao,项目名称:kdguigl,代码行数:10,代码来源:SquirrelObject.cpp

示例2: 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;
}
开发者ID:469306621,项目名称:Languages,代码行数:36,代码来源:sc_plugin.cpp

示例3: GetValue

SquirrelObject SquirrelObject::GetValue(const SQChar *key)/*const*/
{
	SquirrelObject ret;
	if(GetSlot(key)) {
		ret.AttachToStackObject(-1);
		sq_pop(m_Vm.GetVMPtr(),1);
	}
	sq_pop(m_Vm.GetVMPtr(),1);
	return ret;
}
开发者ID:henryrao,项目名称:kdguigl,代码行数:10,代码来源:SquirrelObject.cpp

示例4: GetDelegate

SquirrelObject SquirrelObject::GetDelegate()
{
	SquirrelObject ret;
	if(_o._type == OT_TABLE || _o._type == OT_USERDATA)
	{
		sq_pushobject(m_Vm.GetVMPtr(),_o);
		sq_getdelegate(m_Vm.GetVMPtr(),-1);
		ret.AttachToStackObject(-1);
		sq_pop(m_Vm.GetVMPtr(),2);
	}
	return ret;
}
开发者ID:henryrao,项目名称:kdguigl,代码行数:12,代码来源:SquirrelObject.cpp

示例5: Clone

SquirrelObject SquirrelObject::Clone()
{
	SquirrelObject ret;
	if(GetType() == OT_TABLE || GetType() == OT_ARRAY)
	{
		sq_pushobject(m_Vm.GetVMPtr(),_o);
		sq_clone(m_Vm.GetVMPtr(),-1);
		ret.AttachToStackObject(-1);
		sq_pop(m_Vm.GetVMPtr(),2);
	}
	return ret;

}
开发者ID:henryrao,项目名称:kdguigl,代码行数:13,代码来源:SquirrelObject.cpp

示例6: GetAttributes

SquirrelObject SquirrelObject::GetAttributes(const SQChar *key)
{
	SquirrelObject ret;
	int top = sq_gettop(m_Vm.GetVMPtr());
	sq_pushobject(m_Vm.GetVMPtr(),_o);
	if(key)
		sq_pushstring(m_Vm.GetVMPtr(),key,-1);
	else
		sq_pushnull(m_Vm.GetVMPtr());
	if(SQ_SUCCEEDED(sq_getattributes(m_Vm.GetVMPtr(),-2))) {
		ret.AttachToStackObject(-1);
	}
	sq_settop(m_Vm.GetVMPtr(),top);
	return ret;
}
开发者ID:henryrao,项目名称:kdguigl,代码行数:15,代码来源:SquirrelObject.cpp

示例7: CreateClass

BOOL CreateClass(HSQUIRRELVM v,SquirrelObject & newClass,SQUserPointer classType,const SQChar * name,const SQChar * baseName) {
  int n = 0;
  int oldtop = sq_gettop(v);
  sq_pushroottable(v);
  sq_pushstring(v,name,-1);
  if (baseName) {
    sq_pushstring(v,baseName,-1);
    if (SQ_FAILED(sq_get(v,-3))) { // Make sure the base exists if specified by baseName.
      sq_settop(v,oldtop);
      return FALSE;
    } // if
  } // if
  if (SQ_FAILED(sq_newclass(v,baseName ? 1 : 0))) { // Will inherit from base class on stack from sq_get() above.
    sq_settop(v,oldtop);
    return FALSE;
  } // if
  newClass.AttachToStackObject(-1);
  sq_settypetag(v,-1,classType);
  sq_createslot(v,-3);
  sq_pop(v,1);
  return TRUE;
} // CreateClass
开发者ID:Hiroyuki-Nagata,项目名称:mona,代码行数:22,代码来源:SqPlus.cpp


注:本文中的SquirrelObject::AttachToStackObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。