File diff r25704:4edd52337cbd → r25705:db1afb7a7392
src/script/squirrel_helper.hpp
Show inline comments
 
@@ -751,15 +751,15 @@ namespace SQConvert {
 
		sq_get(vm, -2);
 
		sq_pushobject(vm, instance);
 
		if (sq_instanceof(vm) != SQTrue) return sq_throwerror(vm, "class method is non-static");
 
		sq_pop(vm, 3);
 

	
 
		/* Get the 'real' instance of this class */
 
		sq_getinstanceup(vm, 1, &real_instance, 0);
 
		sq_getinstanceup(vm, 1, &real_instance, nullptr);
 
		/* Get the real function pointer */
 
		sq_getuserdata(vm, nparam, &ptr, 0);
 
		sq_getuserdata(vm, nparam, &ptr, nullptr);
 
		if (real_instance == nullptr) return sq_throwerror(vm, "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 */
 
@@ -793,15 +793,15 @@ namespace SQConvert {
 
		sq_get(vm, -2);
 
		sq_pushobject(vm, instance);
 
		if (sq_instanceof(vm) != SQTrue) return sq_throwerror(vm, "class method is non-static");
 
		sq_pop(vm, 3);
 

	
 
		/* Get the 'real' instance of this class */
 
		sq_getinstanceup(vm, 1, &real_instance, 0);
 
		sq_getinstanceup(vm, 1, &real_instance, nullptr);
 
		/* Get the real function pointer */
 
		sq_getuserdata(vm, nparam, &ptr, 0);
 
		sq_getuserdata(vm, nparam, &ptr, nullptr);
 
		if (real_instance == nullptr) return sq_throwerror(vm, "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);
 
@@ -817,13 +817,13 @@ namespace SQConvert {
 
	{
 
		/* Find the amount of params we got */
 
		int nparam = sq_gettop(vm);
 
		SQUserPointer ptr = nullptr;
 

	
 
		/* Get the real function pointer */
 
		sq_getuserdata(vm, nparam, &ptr, 0);
 
		sq_getuserdata(vm, nparam, &ptr, nullptr);
 

	
 
		try {
 
			/* Delegate it to a template that can handle this specific function */
 
			return HelperT<Tmethod>::SQCall((Tcls *)nullptr, *(Tmethod *)ptr, vm);
 
		} catch (SQInteger &e) {
 
			return e;
 
@@ -841,13 +841,13 @@ namespace SQConvert {
 
	{
 
		/* Find the amount of params we got */
 
		int nparam = sq_gettop(vm);
 
		SQUserPointer ptr = nullptr;
 

	
 
		/* Get the real function pointer */
 
		sq_getuserdata(vm, nparam, &ptr, 0);
 
		sq_getuserdata(vm, nparam, &ptr, nullptr);
 
		/* Remove the userdata from the stack */
 
		sq_pop(vm, 1);
 

	
 
		/* Call the function, which its only param is always the VM */
 
		return (SQInteger)(*(*(Tmethod *)ptr))(vm);
 
	}