1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
.. _api_ref_stack_operations:
================
Stack Operations
================
.. _sq_cmp:
.. c:function:: SQInteger sq_cmp(HSQUIRRELVM v)
:param HSQUIRRELVM v: the target VM
:returns: > 0 if obj1>obj2
:returns: == 0 if obj1==obj2
:returns: < 0 if obj1<obj2
compares 2 object from the stack and compares them.
.. _sq_gettop:
.. c:function:: SQInteger sq_gettop(HSQUIRRELVM v)
:param HSQUIRRELVM v: the target VM
:returns: an integer representing the index of the top of the stack
returns the index of the top of the stack
.. _sq_pop:
.. c:function:: void sq_pop(HSQUIRRELVM v, SQInteger nelementstopop)
:param HSQUIRRELVM v: the target VM
:param SQInteger nelementstopop: the number of elements to pop
pops n elements from the stack
.. _sq_poptop:
.. c:function:: void sq_poptop(HSQUIRRELVM v)
:param HSQUIRRELVM v: the target VM
pops 1 object from the stack
.. _sq_push:
.. c:function:: void sq_push(HSQUIRRELVM v, SQInteger idx)
:param HSQUIRRELVM v: the target VM
:param SQInteger idx: the index in the stack of the value that has to be pushed
pushes in the stack the value at the index idx
.. _sq_remove:
.. c:function:: void sq_remove(HSQUIRRELVM v, SQInteger idx)
:param HSQUIRRELVM v: the target VM
:param SQInteger idx: index of the element that has to be removed
removes an element from an arbitrary position in the stack
.. _sq_reservestack:
.. c:function:: SQRESULT sq_reservestack(HSQUIRRELVM v, SQInteger nsize)
:param HSQUIRRELVM v: the target VM
:param SQInteger nsize: required stack size
:returns: a SQRESULT
ensure that the stack space left is at least of a specified size.If the stack is smaller it will automatically grow. if there's a memtamethod currently running the function will fail and the stack will not be resized, this situatuation has to be considered a "stack overflow".
.. _sq_settop:
.. c:function:: void sq_settop(HSQUIRRELVM v, SQInteger v)
:param HSQUIRRELVM v: the target VM
:param SQInteger v: the new top index
resize the stack, if new top is bigger then the current top the function will push nulls.
|