您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ sq_get函数代码示例

51自学网 2021-06-03 08:11:44
  C++
这篇教程C++ sq_get函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中sq_get函数的典型用法代码示例。如果您正苦于以下问题:C++ sq_get函数的具体用法?C++ sq_get怎么用?C++ sq_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

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

示例1: invokeImpactEvent

	/*	 * invoke impact event	 */	static SQBool invokeImpactEvent(HSQUIRRELVM v, ContactPoint cp) {		SQBool result = false;		SQInteger top = sq_gettop(v);		sq_pushroottable(v);		sq_pushstring(v, "emo", -1);		if (SQ_SUCCEEDED(sq_get(v, -2))) {			sq_pushstring(v, "_onImpact", -1);			if(SQ_SUCCEEDED(sq_get(v, -2))) {				sq_pushroottable(v);				sq_pushuserpointer(v, cp.fixtureA);				sq_pushuserpointer(v, cp.fixtureB);				sq_pushuserpointer(v, cp.fixtureA->GetBody());				sq_pushuserpointer(v, cp.fixtureB->GetBody());				pushVec2(v, cp.position);				pushVec2(v, cp.normal);				sq_pushfloat(v, cp.normalImpulse);				sq_pushfloat(v, cp.tangentImpulse);				result = SQ_SUCCEEDED(sq_call(v, 9, SQFalse, SQTrue));			}		}		sq_settop(v,top);		return result;	}
开发者ID:pandazheng,项目名称:emo-framework,代码行数:28,


示例2: createSQObject

/* * create a instance */SQInteger createSQObject(HSQUIRRELVM v, 				const char* package_name, const char* name,				SQUserPointer ptr, SQRELEASEHOOK releaseHook) {	sq_pushroottable(v);		sq_pushstring(v, package_name, -1);	if (!SQ_SUCCEEDED(sq_get(v, -2))) {		sq_pop(v, 1);		return 0;	}	if (name != NULL) {		sq_pushstring(v, name, -1);		if (!SQ_SUCCEEDED(sq_get(v, -2))) {			sq_pop(v, 2);			return 0;		}	}		sq_createinstance(v, -1);	sq_setinstanceup(v, -1, ptr);	if (releaseHook != NULL) {		sq_setreleasehook(v, -1, releaseHook);	}	sq_remove(v, -2);	sq_remove(v, -2);	return 1;}
开发者ID:pandazheng,项目名称:emo-framework,代码行数:31,


示例3: init_streamclass

void init_streamclass(HSQUIRRELVM v){    sq_pushregistrytable(v);    sq_pushstring(v,_SC("std_stream"),-1);    if(SQ_FAILED(sq_get(v,-2))) {        sq_pushstring(v,_SC("std_stream"),-1);        sq_newclass(v,SQFalse);        sq_settypetag(v,-1,(SQUserPointer)SQSTD_STREAM_TYPE_TAG);        SQInteger i = 0;        while(_stream_methods[i].name != 0) {            const SQRegFunction &f = _stream_methods[i];            sq_pushstring(v,f.name,-1);            sq_newclosure(v,f.f,0);            sq_setparamscheck(v,f.nparamscheck,f.typemask);            sq_newslot(v,-3,SQFalse);            i++;        }        sq_newslot(v,-3,SQFalse);        sq_pushroottable(v);        sq_pushstring(v,_SC("stream"),-1);        sq_pushstring(v,_SC("std_stream"),-1);        sq_get(v,-4);        sq_newslot(v,-3,SQFalse);        sq_pop(v,1);    }    else {        sq_pop(v,1); //result    }    sq_pop(v,1);}
开发者ID:Eiyeron,项目名称:squirrel,代码行数:30,


示例4: register_member_func_with_namespace

/* * Register member method with namespace * Must be called before loading script files */void register_member_func_with_namespace(HSQUIRRELVM v, const char* nname, const char* cname, const char* fname, SQFUNCTION func) {    sq_pushroottable(v);    sq_pushstring(v, nname, -1);    if(SQ_SUCCEEDED(sq_get(v, -2))) {        sq_pushstring(v, cname, -1);        if(SQ_SUCCEEDED(sq_get(v, -2))) {            sq_pushstring(v, fname, -1);            sq_newclosure(v, func, 0);            sq_newslot(v, -3, true);        }    }    sq_pop(v, 1);}
开发者ID:pandazheng,项目名称:emo-framework,代码行数:17,


示例5: declare_stream

SQRESULT declare_stream(HSQUIRRELVM v,const SQChar* name,SQUserPointer typetag,const SQChar* reg_name,const SQRegFunction *methods,const SQRegFunction *globals){    if(sq_gettype(v,-1) != OT_TABLE)        return sq_throwerror(v,_SC("table expected"));    SQInteger top = sq_gettop(v);    //create delegate    init_streamclass(v);    sq_pushregistrytable(v);    sq_pushstring(v,reg_name,-1);    sq_pushstring(v,_SC("std_stream"),-1);    if(SQ_SUCCEEDED(sq_get(v,-3))) {        sq_newclass(v,SQTrue);        sq_settypetag(v,-1,typetag);        SQInteger i = 0;        while(methods[i].name != 0) {            const SQRegFunction &f = methods[i];            sq_pushstring(v,f.name,-1);            sq_newclosure(v,f.f,0);            sq_setparamscheck(v,f.nparamscheck,f.typemask);            sq_setnativeclosurename(v,-1,f.name);            sq_newslot(v,-3,SQFalse);            i++;        }        sq_newslot(v,-3,SQFalse);        sq_pop(v,1);        i = 0;        while(globals[i].name!=0)        {            const SQRegFunction &f = globals[i];            sq_pushstring(v,f.name,-1);            sq_newclosure(v,f.f,0);            sq_setparamscheck(v,f.nparamscheck,f.typemask);            sq_setnativeclosurename(v,-1,f.name);            sq_newslot(v,-3,SQFalse);            i++;        }        //register the class in the target table        sq_pushstring(v,name,-1);        sq_pushregistrytable(v);        sq_pushstring(v,reg_name,-1);        sq_get(v,-2);        sq_remove(v,-2);        sq_newslot(v,-3,SQFalse);        sq_settop(v,top);        return SQ_OK;    }    sq_settop(v,top);    return SQ_ERROR;}
开发者ID:Eiyeron,项目名称:squirrel,代码行数:51,


示例6: DefSQAdvancedNonStaticCallback

	inline SQInteger DefSQAdvancedNonStaticCallback(HSQUIRRELVM vm)	{		/* Find the amount of params we got */		int nparam = sq_gettop(vm);		SQUserPointer ptr = NULL;		SQUserPointer real_instance = NULL;		HSQOBJECT instance;		/* Get the 'SQ' instance of this class */		Squirrel::GetInstance(vm, &instance);		/* Protect against calls to a non-static method in a static way */		sq_pushroottable(vm);		sq_pushstring(vm, OTTD2SQ(Tcls::GetClassName()), -1);		sq_get(vm, -2);		sq_pushobject(vm, instance);		if (sq_instanceof(vm) != SQTrue) return sq_throwerror(vm, _SC("class method is non-static"));		sq_pop(vm, 3);		/* Get the 'real' instance of this class */		sq_getinstanceup(vm, 1, &real_instance, 0);		/* Get the real function pointer */		sq_getuserdata(vm, nparam, &ptr, 0);		if (real_instance == NULL) return sq_throwerror(vm, _SC("couldn't detect real instance of class for non-static call"));		/* Remove the userdata from the stack */		sq_pop(vm, 1);		/* Call the function, which its only param is always the VM */		return (SQInteger)(((Tcls *)real_instance)->*(*(Tmethod *)ptr))(vm);	}
开发者ID:andrew889,项目名称:OpenTTD,代码行数:30,


示例7: DefSQNonStaticCallback

	inline SQInteger DefSQNonStaticCallback(HSQUIRRELVM vm)	{		/* Find the amount of params we got */		int nparam = sq_gettop(vm);		SQUserPointer ptr = NULL;		SQUserPointer real_instance = NULL;		HSQOBJECT instance;		/* Get the 'SQ' instance of this class */		Squirrel::GetInstance(vm, &instance);		/* Protect against calls to a non-static method in a static way */		sq_pushroottable(vm);		sq_pushstring(vm, OTTD2SQ(Tcls::GetClassName()), -1);		sq_get(vm, -2);		sq_pushobject(vm, instance);		if (sq_instanceof(vm) != SQTrue) return sq_throwerror(vm, _SC("class method is non-static"));		sq_pop(vm, 3);		/* Get the 'real' instance of this class */		sq_getinstanceup(vm, 1, &real_instance, 0);		/* Get the real function pointer */		sq_getuserdata(vm, nparam, &ptr, 0);		if (real_instance == NULL) return sq_throwerror(vm, _SC("couldn't detect real instance of class for non-static call"));		/* Remove the userdata from the stack */		sq_pop(vm, 1);		try {			/* Delegate it to a template that can handle this specific function */			return HelperT<Tmethod>::SQCall((Tcls *)real_instance, *(Tmethod *)ptr, vm);		} catch (SQInteger e) {			sq_pop(vm, nparam);			return e;		}	}
开发者ID:andrew889,项目名称:OpenTTD,代码行数:35,


示例8: has_float

bool has_float(HSQUIRRELVM vm, const char* name){  sq_pushstring(vm, name, -1);  if (SQ_FAILED(sq_get(vm, -2))) return false;  sq_pop(vm, 1);  return true;}
开发者ID:CRS-ECHO51,项目名称:supertux,代码行数:7,


示例9: sq_gettop

void CSquirrelVM::BeginRegisterScriptClass(const char* className, scriptFunction pfnFunction, void* userPointer, const char* baseClass){	iFuncIndex = 0;#if 1	int n = 0;	oldtop = sq_gettop(m_pVM);	sq_pushroottable(m_pVM);	sq_pushstring(m_pVM, className, -1);	if(baseClass) {		sq_pushstring(m_pVM, baseClass, -1);		if(SQ_FAILED(sq_get(m_pVM, -3))) { // make sure base exists			sq_settop(m_pVM, oldtop);			return;		}	}	if(SQ_FAILED(sq_newclass(m_pVM, baseClass ? 1 : 0))) {		sq_settop(m_pVM, oldtop);		return;	}	sq_pushstring(m_pVM, _SC("constructor"), -1);	if (userPointer != nullptr)	{		sq_pushuserpointer(m_pVM, userPointer);		sq_newclosure(m_pVM, (SQFUNCTION) pfnFunction, 1);	}	else		sq_newclosure(m_pVM, (SQFUNCTION)pfnFunction, 0);	sq_newslot(m_pVM, -3, false); // Add the constructor method#endif}
开发者ID:RAG20,项目名称:IV-Network,代码行数:33,


示例10: assert

bool Squirrel::CallMethod(HSQOBJECT instance, const char *method_name, HSQOBJECT *ret, int suspend){	assert(!this->crashed);	/* Store the stack-location for the return value. We need to	 * restore this after saving or the stack will be corrupted	 * if we're in the middle of a DoCommand. */	SQInteger last_target = this->vm->_suspended_target;	/* Store the current top */	int top = sq_gettop(this->vm);	/* Go to the instance-root */	sq_pushobject(this->vm, instance);	/* Find the function-name inside the script */	sq_pushstring(this->vm, OTTD2SQ(method_name), -1);	if (SQ_FAILED(sq_get(this->vm, -2))) {		DEBUG(misc, 0, "[squirrel] Could not find '%s' in the class", method_name);		sq_settop(this->vm, top);		return false;	}	/* Call the method */	sq_pushobject(this->vm, instance);	if (SQ_FAILED(sq_call(this->vm, 1, ret == NULL ? SQFalse : SQTrue, SQTrue, suspend))) return false;	if (ret != NULL) sq_getstackobj(vm, -1, ret);	/* Reset the top, but don't do so for the AI main function, as we need	 *  a correct stack when resuming. */	if (suspend == -1 || !this->IsSuspended()) sq_settop(this->vm, top);	/* Restore the return-value location. */	this->vm->_suspended_target = last_target;	return true;}
开发者ID:dolly22,项目名称:openttd-sai,代码行数:30,


示例11: sq_gettop

/** * squirrel から吉里吉里オブジェクトを取得 */boolTJSObject::getVariant(HSQUIRRELVM v, SQInteger idx, tTJSVariant *variant){    if (sq_gettype(v, idx) == OT_CLASS) {        if (idx < 0) {            idx = sq_gettop(v) + 1 + idx;        }        bool ret = false;        // クラス属性からオブジェクト情
C++ sq_getinteger函数代码示例
C++ sq_createslot函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。