sgs_FCall [functions]
int sgs_FCall( sgs_Context* C, int args, int expect, int gotthis )
Call the function with the arguments on stack, returning the expected number of variables on stack.
args
: the primary variables to be passed to the function, in the same order they are in the stack.expect
: the number of variables to be left after a successful call.gotthis
: whether the function is a method and an additional argument needs to be passed as the 'this' value before others.- Return value of function is the original number of returned values on stack from this call.
After a successful call, all arguments will be popped off the stack and the expected number of variables will appear in their place. If the underlying callable does not return enough values, 'null' variables will be pushed instead. If the number of returned values is bigger than expected, only the first expected return values will stay on the stack.
- Expected stack structure:
- [function]
- (if gotthis != 0) [this]
- [argument] x
args
- A callable is one of the following:
- SGS function
- C function
- object with CALL interface function defined
To check if function call was aborted, see sgs_Cntl / SGS_CNTL_GET_ABORT.
To find out if execution state was suspended in this call, see sgs_Cntl / SGS_CNTL_GET_PAUSED.