some doc on sq_tailcall

This commit is contained in:
albertodemichelis 2017-11-17 04:14:15 +08:00
parent 3835c65eab
commit 5460758eb0

View File

@ -87,8 +87,27 @@ reset the last error in the virtual machine to null
resumes the generator at the top position of the stack. resumes the generator at the top position of the stack.
.. _sq_tailcall:
.. c:function:: SQRESULT sq_tailcall(HSQUIRRELVM v, SQInteger nparams)
:param HSQUIRRELVM v: the target VM
:param SQInteger params: number of parameters of the function
Calls a closure and removes the caller function from the call stack.
This function must be invoke from a native closure and
he return value of sq_tailcall must be returned by the caller function(see example).
*.eg*
::
SQInteger tailcall_something_example(HSQUIRRELVM v)
{
//push closure and parameters here
...
return sq_tailcall(v,2);
}
.. _sq_throwerror: .. _sq_throwerror:
@ -101,9 +120,6 @@ resumes the generator at the top position of the stack.
sets the last error in the virtual machine and returns the value that has to be returned by a native closure in order to trigger an exception in the virtual machine. sets the last error in the virtual machine and returns the value that has to be returned by a native closure in order to trigger an exception in the virtual machine.
.. _sq_throwobject: .. _sq_throwobject:
.. c:function:: SQRESULT sq_throwobject(HSQUIRRELVM v) .. c:function:: SQRESULT sq_throwobject(HSQUIRRELVM v)