Fix some small bugs in the documentation examples.
This commit is contained in:
parent
b00cd02629
commit
7d589eb444
@ -164,7 +164,7 @@ pops a key from the stack and delete the slot indexed by it from the table at po
|
|||||||
:param HSQUIRRELVM v: the target VM
|
:param HSQUIRRELVM v: the target VM
|
||||||
:param SQInteger idx: index of the target object in the stack
|
:param SQInteger idx: index of the target object in the stack
|
||||||
:returns: a SQRESULT
|
:returns: a SQRESULT
|
||||||
:remarks: this call will invokes the delegation system like a normal dereference it only works on tables, arrays and userdata; if the function fails, nothing will be pushed in the stack.
|
:remarks: this call will invokes the delegation system like a normal dereference it only works on tables, arrays, classes, instances and userdata; if the function fails, nothing will be pushed in the stack.
|
||||||
|
|
||||||
pops a key from the stack and performs a get operation on the object at the position idx in the stack; and pushes the result in the stack.
|
pops a key from the stack and performs a get operation on the object at the position idx in the stack; and pushes the result in the stack.
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ parameter is > 0. ::
|
|||||||
sq_pushinteger(v,1);
|
sq_pushinteger(v,1);
|
||||||
sq_pushfloat(v,2.0);
|
sq_pushfloat(v,2.0);
|
||||||
sq_pushstring(v,"three",-1);
|
sq_pushstring(v,"three",-1);
|
||||||
sq_call(v,4,SQFalse);
|
sq_call(v,4,SQFalse,SQFalse);
|
||||||
sq_pop(v,2); //pops the roottable and the function
|
sq_pop(v,2); //pops the roottable and the function
|
||||||
|
|
||||||
this is equivalent to the following Squirrel code::
|
this is equivalent to the following Squirrel code::
|
||||||
|
@ -8,7 +8,7 @@ You can compile a Squirrel script with the function *sq_compile*.::
|
|||||||
|
|
||||||
typedef SQInteger (*SQLEXREADFUNC)(SQUserPointer userdata);
|
typedef SQInteger (*SQLEXREADFUNC)(SQUserPointer userdata);
|
||||||
|
|
||||||
SQRESULT sq_compile(HSQUIRRELVM v,SQREADFUNC read,SQUserPointer p,
|
SQRESULT sq_compile(HSQUIRRELVM v,SQLEXREADFUNC read,SQUserPointer p,
|
||||||
const SQChar *sourcename,SQBool raiseerror);
|
const SQChar *sourcename,SQBool raiseerror);
|
||||||
|
|
||||||
In order to compile a script is necessary for the host application to implement a reader
|
In order to compile a script is necessary for the host application to implement a reader
|
||||||
|
@ -99,7 +99,8 @@ Here an example of how to register a function::
|
|||||||
{
|
{
|
||||||
sq_pushroottable(v);
|
sq_pushroottable(v);
|
||||||
sq_pushstring(v,fname,-1);
|
sq_pushstring(v,fname,-1);
|
||||||
sq_newclosure(v,f,0,0); //create a new function
|
sq_newclosure(v,f,0); //create a new function
|
||||||
sq_newslot(v,-3,SQFalse);
|
sq_newslot(v,-3,SQFalse);
|
||||||
sq_pop(v,1); //pops the root table
|
sq_pop(v,1); //pops the root table
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ The object can be also re-pushed in the VM stack using sq_pushobject().::
|
|||||||
|
|
||||||
HSQOBJECT obj;
|
HSQOBJECT obj;
|
||||||
|
|
||||||
sq_resetobject(&obj) //initialize the handle
|
sq_resetobject(&obj); //initialize the handle
|
||||||
sq_getstackobj(v,-2,&obj); //retrieve an object handle from the pos -2
|
sq_getstackobj(v,-2,&obj); //retrieve an object handle from the pos -2
|
||||||
sq_addref(v,&obj); //adds a reference to the object
|
sq_addref(v,&obj); //adds a reference to the object
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user