fix various typos and incompletely apply very lightweight formatting normalization; clarify sq_getbyhandle applies to class or instance
This commit is contained in:
parent
f8f229fa00
commit
b35c9e827c
@ -29,4 +29,4 @@ serialize (read) a closure and pushes it on top of the stack, the source is user
|
||||
:returns: a SQRESULT
|
||||
:remarks: closures with free variables cannot be serialized
|
||||
|
||||
serializes(writes) the closure on top of the stack, the desination is user defined through a write callback.
|
||||
serializes(writes) the closure on top of the stack, the destination is user defined through a write callback.
|
@ -9,9 +9,9 @@ Garbage Collector
|
||||
.. c:function:: SQInteger sq_collectgarbage(HSQUIRRELVM v)
|
||||
|
||||
:param HSQUIRRELVM v: the target VM
|
||||
:remarks: this api only works with gabage collector builds (NO_GARBAGE_COLLECTOR is not defined)
|
||||
:remarks: this api only works with garbage collector builds (NO_GARBAGE_COLLECTOR is not defined)
|
||||
|
||||
runs the garbage collector and returns the number of reference cycles found(and deleted)
|
||||
runs the garbage collector and returns the number of reference cycles found (and deleted)
|
||||
|
||||
|
||||
|
||||
@ -22,6 +22,6 @@ runs the garbage collector and returns the number of reference cycles found(and
|
||||
.. c:function:: SQRESULT sq_resurrectunreachable(HSQUIRRELVM v)
|
||||
|
||||
:param HSQUIRRELVM v: the target VM
|
||||
:remarks: this api only works with gabage collector builds (NO_GARBAGE_COLLECTOR is not defined)
|
||||
:remarks: this api only works with garbage collector builds (NO_GARBAGE_COLLECTOR is not defined)
|
||||
|
||||
runs the garbage collector and pushes an array in the stack containing all unreachable object found. If no unreachable object is found, null is pushed instead. This function is meant to help debugging reference cycles.
|
||||
runs the garbage collector and pushes an array in the stack containing all unreachable object found. If no unreachable object is found, null is pushed instead. This function is meant to help debug reference cycles.
|
@ -13,7 +13,7 @@ Object creation and handling
|
||||
:returns: a SQRESULT
|
||||
:remarks: the cloned closure holds the environment object as weak reference
|
||||
|
||||
pops an object from the stack(must be a table,instance or class) clones the closure at position idx in the stack and sets the popped object as environment of the cloned closure. Then pushes the new cloned closure on top of the stack.
|
||||
pops an object from the stack (must be a table, instance, or class); clones the closure at position idx in the stack and sets the popped object as environment of the cloned closure. Then pushes the new cloned closure on top of the stack.
|
||||
|
||||
|
||||
|
||||
@ -54,8 +54,8 @@ gets the value of the bool at the idx position in the stack.
|
||||
.. c:function:: SQRESULT sq_getbyhandle(HSQUIRRELVM v, SQInteger idx, HSQMEMBERHANDLE* handle)
|
||||
|
||||
:param HSQUIRRELVM v: the target VM
|
||||
:param SQInteger idx: an index in the stack pointing to the class
|
||||
:param HSQMEMBERHANDLE* handle: a pointer the member handle
|
||||
:param SQInteger idx: an index in the stack pointing to the class or instance
|
||||
:param HSQMEMBERHANDLE* handle: a pointer to the member handle
|
||||
:returns: a SQRESULT
|
||||
|
||||
pushes the value of a class or instance member using a member handle (see sq_getmemberhandle)
|
||||
@ -88,7 +88,7 @@ retrieves number of parameters and number of freevariables from a squirrel closu
|
||||
:param SQInteger idx: index of the target closure
|
||||
:returns: an SQRESULT
|
||||
|
||||
pushes the name of the closure at poistion idx in the stack. Note that the name can be a string or null if the closure is anonymous or a native closure with no name assigned to it.
|
||||
pushes the name of the closure at position idx in the stack. Note that the name can be a string or null if the closure is anonymous or a native closure with no name assigned to it.
|
||||
|
||||
|
||||
|
||||
@ -179,7 +179,7 @@ gets the value of the integer at the idx position in the stack.
|
||||
:returns: a SQRESULT
|
||||
:remarks: This method works only with classes. A handle retrieved through a class can be later used to set or get values from one of the class instances. Handles retrieved from base classes are still valid in derived classes and respect inheritance rules.
|
||||
|
||||
pops a value from the stack and uses it as index to fetch the handle of a class member. The handle can be later used to set or get the member value using sq_getbyhandle(),sq_setbyhandle().
|
||||
pops a value from the stack and uses it as index to fetch the handle of a class member. The handle can be later used to set or get the member value using sq_getbyhandle(), sq_setbyhandle().
|
||||
|
||||
|
||||
|
||||
@ -220,9 +220,9 @@ returns a pointer to a memory buffer that is at least as big as minsize.
|
||||
:param HSQUIRRELVM v: the target VM
|
||||
:param SQInteger idx: an index in the stack
|
||||
:returns: the size of the value at the position idx in the stack
|
||||
:remarks: this function only works with strings,arrays,tables,classes,instances and userdata if the value is not a valid type types the function will return -1.
|
||||
:remarks: this function only works with strings, arrays, tables, classes, instances, and userdata if the value is not a valid type, the function will return -1.
|
||||
|
||||
returns the size of a value at the idx position in the stack, if the value is a class or a class instance the size returned is the size of the userdata buffer(see sq_setclassudsize).
|
||||
returns the size of a value at the idx position in the stack. If the value is a class or a class instance the size returned is the size of the userdata buffer (see sq_setclassudsize).
|
||||
|
||||
|
||||
|
||||
@ -252,7 +252,7 @@ gets a pointer to the string at the idx position in the stack.
|
||||
:param HSQUIRRELVM* v: A pointer to the variable that will store the thread pointer
|
||||
:returns: a SQRESULT
|
||||
|
||||
gets a a pointer to the thread the idx position in the stack.
|
||||
gets a pointer to the thread the idx position in the stack.
|
||||
|
||||
|
||||
|
||||
@ -282,7 +282,7 @@ returns the type of the value at the position idx in the stack
|
||||
:returns: a SQRESULT
|
||||
:remarks: the function works also with instances. if the taget object is an instance, the typetag of it's base class is fetched.
|
||||
|
||||
gets the typetag of the object(userdata or class) at position idx in the stack.
|
||||
gets the typetag of the object (userdata or class) at position idx in the stack.
|
||||
|
||||
|
||||
|
||||
@ -379,7 +379,7 @@ creates a new table and pushes it in the stack
|
||||
:param HSQUIRRELVM v: the target VM
|
||||
:param SQInteger initialcapacity: number of key/value pairs to preallocate
|
||||
|
||||
creates a new table and pushes it in the stack. This function allows to specify the initial capacity of the table to prevent unnecessary rehashing when the number of slots required is known at creation-time.
|
||||
creates a new table and pushes it in the stack. This function allows you to specify the initial capacity of the table to prevent unnecessary rehashing when the number of slots required is known at creation-time.
|
||||
|
||||
|
||||
|
||||
@ -431,7 +431,7 @@ pushes a float into the stack
|
||||
:param HSQUIRRELVM v: the target VM
|
||||
:param SQInteger n: the integer that has to be pushed
|
||||
|
||||
pushes a integer into the stack
|
||||
pushes an integer into the stack
|
||||
|
||||
|
||||
|
||||
@ -501,7 +501,7 @@ pops a value from the stack and sets it to a class or instance member using a me
|
||||
:param SQInteger udsize: size in bytes reserved for user data
|
||||
:returns: a SQRESULT
|
||||
|
||||
Sets the user data size of a class. If a class 'user data size' is greater than 0. When an instance of the class is created additional space will is reserved at the end of the memory chunk where the instance is stored. The userpointer of the instance will also be automatically set to this memory area. This allows to minimize allocations in applications that have to carry data along with the class instance.
|
||||
Sets the user data size of a class. If a class 'user data size' is greater than 0. When an instance of the class is created additional space will be reserved at the end of the memory chunk where the instance is stored. The userpointer of the instance will also be automatically set to this memory area. This allows you to minimize allocations in applications that have to carry data along with the class instance.
|
||||
|
||||
|
||||
|
||||
@ -515,7 +515,7 @@ Sets the user data size of a class. If a class 'user data size' is greater than
|
||||
:param SQInteger idx: index of the target closure
|
||||
:returns: an SQRESULT
|
||||
|
||||
pops a table from the stack and sets it as root of the closre at position idx in the stack
|
||||
pops a table from the stack and sets it as root of the closure at position idx in the stack
|
||||
|
||||
|
||||
|
||||
@ -545,7 +545,7 @@ sets the userpointer of the class instance at position idx in the stack.
|
||||
:param const SQChar * name: the name that has to be set
|
||||
:returns: an SQRESULT
|
||||
|
||||
sets the name of the native closure at the position idx in the stack. the name of a native closure is purely for debug pourposes. The name is retieved trough the function sq_stackinfos() while the closure is in the call stack.
|
||||
sets the name of the native closure at the position idx in the stack. The name of a native closure is purely for debug purposes. The name is retrieved trough the function sq_stackinfos() while the closure is in the call stack.
|
||||
|
||||
|
||||
|
||||
@ -556,11 +556,11 @@ sets the name of the native closure at the position idx in the stack. the name o
|
||||
.. c:function:: SQRESULT sq_setparamscheck(HSQUIRRELVM v, SQInteger nparamscheck, const SQChar * typemask)
|
||||
|
||||
:param HSQUIRRELVM v: the target VM
|
||||
:param SQInteger nparamscheck: defines the parameters number check policy(0 disable the param checking). if nparamscheck is greater than 0 the VM ensures that the number of parameters is exactly the number specified in nparamscheck(eg. if nparamscheck == 3 the function can only be called with 3 parameters). if nparamscheck is less than 0 the VM ensures that the closure is called with at least the absolute value of the number specified in nparamcheck(eg. nparamscheck == -3 will check that the function is called with at least 3 parameters). the hidden paramater 'this' is included in this number free variables aren't. If SQ_MATCHTYPEMASKSTRING is passed instead of the number of parameters, the function will automatically extrapolate the number of parameters to check from the typemask(eg. if the typemask is ".sn" is like passing 3).
|
||||
:param const SQChar * typemask: defines a mask to validate the parametes types passed to the function. if the parameter is NULL no typechecking is applyed(default).
|
||||
:remarks: The typemask consists in a zero teminated string that represent the expected parameter type. The types are expressed as follows: 'o' null, 'i' integer, 'f' float, 'n' integer or float, 's' string, 't' table, 'a' array, 'u' userdata, 'c' closure and nativeclosure, 'g' generator, 'p' userpointer, 'v' thread, 'x' instance(class instance), 'y' class, 'b' bool. and '.' any type. The symbol '|' can be used as 'or' to accept multiple types on the same parameter. There isn't any limit on the number of 'or' that can be used. Spaces are ignored so can be inserted between types to increase readbility. For instance to check a function that espect a table as 'this' a string as first parameter and a number or a userpointer as second parameter, the string would be "tsn|p" (table,string,number or userpointer). If the parameters mask is contains less parameters than 'nparamscheck' the remaining parameters will not be typechecked.
|
||||
:param SQInteger nparamscheck: defines the parameters number check policy (0 disables the param checking). If nparamscheck is greater than 0, the VM ensures that the number of parameters is exactly the number specified in nparamscheck (eg. if nparamscheck == 3 the function can only be called with 3 parameters). If nparamscheck is less than 0 the VM ensures that the closure is called with at least the absolute value of the number specified in nparamcheck (eg. nparamscheck == -3 will check that the function is called with at least 3 parameters). The hidden parameter 'this' is included in this number; free variables aren't. If SQ_MATCHTYPEMASKSTRING is passed instead of the number of parameters, the function will automatically infer the number of parameters to check from the typemask (eg. if the typemask is ".sn", it is like passing 3).
|
||||
:param const SQChar * typemask: defines a mask to validate the parametes types passed to the function. If the parameter is NULL, no typechecking is applied (default).
|
||||
:remarks: The typemask consists in a zero terminated string that represent the expected parameter type. The types are expressed as follows: 'o' null, 'i' integer, 'f' float, 'n' integer or float, 's' string, 't' table, 'a' array, 'u' userdata, 'c' closure and nativeclosure, 'g' generator, 'p' userpointer, 'v' thread, 'x' instance(class instance), 'y' class, 'b' bool. and '.' any type. The symbol '|' can be used as 'or' to accept multiple types on the same parameter. There isn't any limit on the number of 'or' that can be used. Spaces are ignored so can be inserted between types to increase readability. For instance to check a function that expect a table as 'this' a string as first parameter and a number or a userpointer as second parameter, the string would be "tsn|p" (table,string,number or userpointer). If the parameters mask is contains fewer parameters than 'nparamscheck', the remaining parameters will not be typechecked.
|
||||
|
||||
Sets the parameters validation scheme for the native closure at the top position in the stack. Allows to validate the number of parameters accepted by the function and optionally their types. If the function call do not comply with the parameter schema set by sq_setparamscheck, an exception is thrown.
|
||||
Sets the parameter validation scheme for the native closure at the top position in the stack. Allows you to validate the number of parameters accepted by the function and optionally their types. If the function call does not comply with the parameter schema set by sq_setparamscheck, an exception is thrown.
|
||||
|
||||
*.eg*
|
||||
|
||||
@ -572,7 +572,7 @@ Sets the parameters validation scheme for the native closure at the top position
|
||||
SQUserPointer p;
|
||||
const SQChar *s;
|
||||
SQInteger i;
|
||||
//no type checking, if the call comply to the mask
|
||||
//no type checking, if the call complies with the mask
|
||||
//surely the functions will succeed.
|
||||
sq_getuserdata(v,1,&p,NULL);
|
||||
sq_getstring(v,2,&s);
|
||||
@ -603,7 +603,7 @@ Sets the parameters validation scheme for the native closure at the top position
|
||||
:param SQRELEASEHOOK hook: a function pointer to the hook(see sample below)
|
||||
:remarks: the function hook is called by the VM before the userdata memory is deleted.
|
||||
|
||||
sets the release hook of the userdata, class instance or class at position idx in the stack.
|
||||
sets the release hook of the userdata, class instance, or class at position idx in the stack.
|
||||
|
||||
*.eg*
|
||||
|
||||
@ -632,7 +632,7 @@ sets the release hook of the userdata, class instance or class at position idx i
|
||||
:param SQUserPointer typetag: an arbitrary SQUserPointer
|
||||
:returns: a SQRESULT
|
||||
|
||||
sets the typetag of the object(userdata or class) at position idx in the stack.
|
||||
sets the typetag of the object (userdata or class) at position idx in the stack.
|
||||
|
||||
|
||||
|
||||
@ -645,7 +645,7 @@ sets the typetag of the object(userdata or class) at position idx in the stack.
|
||||
:param HSQUIRRELVM v: the target VM
|
||||
:param SQInteger idx: an index in the stack
|
||||
:param SQBool * b: A pointer to the bool that will store the value
|
||||
:remarks: if the object is not a bool the function converts the value too bool according to squirrel's rules. For instance the number 1 will result in true, and the number 0 in false.
|
||||
:remarks: if the object is not a bool the function converts the value to bool according to squirrel's rules. For instance the number 1 will result in true, and the number 0 in false.
|
||||
|
||||
gets the value at position idx in the stack as bool.
|
||||
|
||||
@ -674,7 +674,7 @@ converts the object at position idx in the stack to string and pushes the result
|
||||
:param SQInteger idx: an index in the stack
|
||||
:returns: a SQRESULT
|
||||
|
||||
pushes the type name of the value at the position idx in the stack, it also invokes the _typeof metamethod for tables and class instances that implement it; in that case the pushed object could be something other than a string (is up to the _typeof implementation).
|
||||
pushes the type name of the value at the position idx in the stack. It also invokes the _typeof metamethod for tables and class instances that implement it; in that case the pushed object could be something other than a string (is up to the _typeof implementation).
|
||||
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@ pops a value from the stack and pushes it in the back of the array at the positi
|
||||
|
||||
:param HSQUIRRELVM v: the target VM
|
||||
:param SQInteger idx: index of the target array in the stack
|
||||
:param SQInteger destpos: the postion in the array where the item has to be inserted
|
||||
:param SQInteger destpos: the position in the array where the item has to be inserted
|
||||
:returns: a SQRESULT
|
||||
:remarks: Only works on arrays.
|
||||
|
||||
@ -74,7 +74,7 @@ removes an item from an array
|
||||
:param SQInteger idx: index of the target array in the stack
|
||||
:param SQInteger newsize: requested size of the array
|
||||
:returns: a SQRESULT
|
||||
:remarks: Only works on arrays.if newsize if greater than the current size the new array slots will be filled with nulls.
|
||||
:remarks: Only works on arrays. If newsize if greater than the current size the new array slots will be filled with nulls.
|
||||
|
||||
resizes the array at the position idx in the stack.
|
||||
|
||||
@ -164,9 +164,9 @@ 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 SQInteger idx: index of the target object in the stack
|
||||
: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 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.
|
||||
|
||||
|
||||
|
||||
@ -180,7 +180,7 @@ pops a key from the stack and performs a get operation on the object at the posi
|
||||
:param SQInteger idx: index of the target class in the stack
|
||||
:returns: a SQRESULT
|
||||
|
||||
Gets the attribute of a class mameber. The function pops a key from the stack and pushes the attribute of the class member indexed by they key from class at position idx in the stack. If key is null the function gets the class level attribute.
|
||||
Gets the attribute of a class member. The function pops a key from the stack and pushes the attribute of the class member indexed by they key from a class at position idx in the stack. If key is null the function gets the class level attribute.
|
||||
|
||||
|
||||
|
||||
@ -267,7 +267,7 @@ pushes the object pointed by the weak reference at position idx in the stack.
|
||||
:returns: SQTrue if the instance at position -2 in the stack is an instance of the class object at position -1 in the stack.
|
||||
:remarks: The function doesn't pop any object from the stack.
|
||||
|
||||
Determintes if an object is an instance of a certain class. Expects an istance and a class in the stack.
|
||||
Determines if an object is an instance of a certain class. Expects an instance and a class in the stack.
|
||||
|
||||
|
||||
|
||||
@ -283,7 +283,7 @@ Determintes if an object is an instance of a certain class. Expects an istance a
|
||||
:returns: a SQRESULT
|
||||
:remarks: Invokes the _newmember metamethod in the class. it only works on classes.
|
||||
|
||||
pops a key, a value and an object(that will be set as attribute of the member) from the stack and performs a new slot operation on the class that is at position idx in the stack, if the slot does not exits it will be created.
|
||||
pops a key, a value and an object (which will be set as attribute of the member) from the stack and performs a new slot operation on the class that is at position idx in the stack; if the slot does not exits it will be created.
|
||||
|
||||
|
||||
|
||||
@ -313,7 +313,7 @@ pops a key and a value from the stack and performs a set operation on the table
|
||||
:param SQInteger idx: index of the target object in the stack
|
||||
:returns: a SQRESULT
|
||||
|
||||
Pushes in the stack the next key and value of an array, table or class slot. To start the iteration this function expects a null value on top of the stack; at every call the function will substitute the null value with an iterator and push key and value of the container slot. Every iteration the application has to pop the previous key and value but leave the iterator(that is used as reference point for the next iteration). The function will fail when all slots have been iterated(see Tables and arrays manipulation).
|
||||
Pushes in the stack the next key and value of an array, table, or class slot. To start the iteration this function expects a null value on top of the stack; at every call the function will substitute the null value with an iterator and push key and value of the container slot. Every iteration the application has to pop the previous key and value but leave the iterator(that is used as reference point for the next iteration). The function will fail when all slots have been iterated(see Tables and arrays manipulation).
|
||||
|
||||
|
||||
|
||||
@ -328,7 +328,7 @@ Pushes in the stack the next key and value of an array, table or class slot. To
|
||||
:param SQBool pushval: if this param is true the function will push the value of the deleted slot.
|
||||
:returns: a SQRESULT
|
||||
|
||||
Deletes a slot from a table without employing the _delslot metamethod. pops a key from the stack and delete the slot indexed by it from the table at position idx in the stack, if the slot does not exits nothing happens.
|
||||
Deletes a slot from a table without employing the _delslot metamethod. Pops a key from the stack and delete the slot indexed by it from the table at position idx in the stack, if the slot does not exits nothing happens.
|
||||
|
||||
|
||||
|
||||
@ -403,7 +403,7 @@ pops a key and a value from the stack and performs a set operation on the object
|
||||
:param SQInteger idx: index of the target class in the stack.
|
||||
:returns: a SQRESULT
|
||||
|
||||
Sets the attribute of a class mameber. The function pops a key and a value from the stack and sets the attribute (indexed by they key) on the class at position idx in the stack. If key is null the function sets the class level attribute. If the function succeed, the old attribute value is pushed in the stack.
|
||||
Sets the attribute of a class member. The function pops a key and a value from the stack and sets the attribute (indexed by the key) on the class at position idx in the stack. If key is null the function sets the class level attribute. If the function succeed, the old attribute value is pushed in the stack.
|
||||
|
||||
|
||||
|
||||
@ -416,9 +416,9 @@ Sets the attribute of a class mameber. The function pops a key and a value from
|
||||
:param HSQUIRRELVM v: the target VM
|
||||
:param SQInteger idx: index of the target object in the stack
|
||||
:returns: a SQRESULT
|
||||
:remarks: to remove the delgate from an object is necessary to use null as delegate instead of a table.
|
||||
:remarks: to remove the delegate from an object, set a null value.
|
||||
|
||||
pops a table from the stack and sets it as delegate of the object at the position idx in the stack.
|
||||
pops a table from the stack and sets it as the delegate of the object at the position idx in the stack.
|
||||
|
||||
|
||||
|
||||
@ -433,7 +433,7 @@ pops a table from the stack and sets it as delegate of the object at the positio
|
||||
:param SQInteger nval: 0 based index of the free variable(relative to the closure).
|
||||
:returns: a SQRESULT
|
||||
|
||||
pops a value from the stack and sets it as free variable of the closure at the position idx in the stack.
|
||||
pops a value from the stack and sets it as a free variable of the closure at the position idx in the stack.
|
||||
|
||||
|
||||
|
||||
|
@ -24,7 +24,7 @@ adds a reference to an object handler.
|
||||
:param HSQOBJECT* o: pointer to an object handler
|
||||
:param SQUserPointer* typetag: a pointer to the variable that will store the tag
|
||||
:returns: a SQRESULT
|
||||
:remarks: the function works also with instances. if the taget object is an instance, the typetag of it's base class is fetched.
|
||||
:remarks: the function works also with instances. if the target object is an instance, the typetag of it's base class is fetched.
|
||||
|
||||
gets the typetag of a raw object reference(userdata or class).
|
||||
|
||||
@ -145,7 +145,7 @@ push an object referenced by an object handler into the stack.
|
||||
:param HSQUIRRELVM v: the target VM
|
||||
:param HSQOBJECT* po: pointer to an object handler
|
||||
:returns: SQTrue if the object handler released has lost all is references(the ones added with sq_addref). SQFalse otherwise.
|
||||
:remarks: the function will reset the object handler to null when it losts all references.
|
||||
:remarks: the function will reset the object handler to null when it loses all references.
|
||||
|
||||
remove a reference from an object handler.
|
||||
|
||||
|
@ -91,7 +91,7 @@ removes an element from an arbitrary position in the stack
|
||||
: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 metamethod currently running the function will fail and the stack will not be resized, this situatuation has to be considered a "stack overflow".
|
||||
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 metamethod currently running the function will fail and the stack will not be resized, this situation has to be considered a "stack overflow".
|
||||
|
||||
|
||||
|
||||
@ -104,4 +104,4 @@ ensure that the stack space left is at least of a specified size.If the stack is
|
||||
: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.
|
||||
resize the stack. If new top is bigger then the current top the function will push nulls.
|
||||
|
@ -63,7 +63,7 @@ returns the current print function of the given Virtual machine. (see sq_setprin
|
||||
:param HSQUIRRELVM v: the target VM
|
||||
:returns: the current VMs shared foreign pointer
|
||||
|
||||
Returns the shared foreign pointer of a group of friend VMs .
|
||||
Returns the shared foreign pointer of a group of friend VMs
|
||||
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ Returns the shared foreign pointer of a group of friend VMs .
|
||||
:param HSQUIRRELVM v: the target VM
|
||||
:returns: the current VMs release hook.
|
||||
|
||||
Returns the shared release hook of a group of friend VMs .
|
||||
Returns the shared release hook of a group of friend VMs
|
||||
|
||||
|
||||
|
||||
@ -88,7 +88,7 @@ Returns the shared release hook of a group of friend VMs .
|
||||
|
||||
:returns: version number of the vm(as in SQUIRREL_VERSION_NUMBER).
|
||||
|
||||
returns the version number of the vm.
|
||||
returns the version number of the vm
|
||||
|
||||
|
||||
|
||||
@ -101,7 +101,7 @@ returns the version number of the vm.
|
||||
:param HSQUIRRELVM v: the target VM
|
||||
:returns: the current VMs release hook.
|
||||
|
||||
Returns the release hook of a VM instance.
|
||||
Returns the release hook of a VM instance
|
||||
|
||||
|
||||
|
||||
@ -128,7 +128,7 @@ returns the execution state of a virtual machine
|
||||
:param HSQUIRRELVM src: the source VM
|
||||
:param SQInteger idx: the index in the source stack of the value that has to be moved
|
||||
|
||||
pushes the object at the position 'idx' of the source vm stack in the destination vm stack.
|
||||
pushes the object at the position 'idx' of the source vm stack in the destination vm stack
|
||||
|
||||
|
||||
|
||||
@ -297,7 +297,7 @@ Sets the release hook of a certain VM group. The release hook is invoked when th
|
||||
:param HSQUIRRELVM v: the target VM
|
||||
:param SQRELESEHOOK hook: The hook that has to be set
|
||||
|
||||
Sets the release hook of a certain VM instance. The release hook is invoked when the vm is destroyed. The userpointer passed to the function is the vm foreignpointer(see sq_setforeignpointer())
|
||||
Sets the release hook of a certain VM instance. The release hook is invoked when the vm is destroyed. The userpointer passed to the function is the vm foreignpointer (see sq_setforeignpointer())
|
||||
|
||||
|
||||
|
||||
@ -338,4 +338,4 @@ Suspends the execution of the specified vm.
|
||||
:param SQBool throwerror: if true, the vm will thow an exception as soon as is resumed. the exception payload must be set beforehand invoking sq_thowerror().
|
||||
:returns: an HRESULT.
|
||||
|
||||
Wake up the execution a previously suspended virtual machine.
|
||||
wake up the execution a previously suspended virtual machine
|
@ -37,13 +37,13 @@ Userdata Alignment
|
||||
.. index:: single: Userdata Alignment
|
||||
|
||||
Both class instances and userdatas can have a buffer associated to them.
|
||||
Squirrel specifies the alignment(in bytes) through the peroprocessor defining 'SQ_ALIGNMENT'.
|
||||
Squirrel specifies the alignment(in bytes) through the preprocessor defining 'SQ_ALIGNMENT'.
|
||||
By default SQ_ALIGNMENT is defined as 4 for 32 bits builds and 8 for 64bits builds and builds that use 64bits floats.
|
||||
It is possible to override the value of SQ_ALIGNMENT respecting the following rules.
|
||||
SQ_ALIGNMENT shall be less than or equal to SQ_MALLOC alignments, and it shall be power of 2.
|
||||
|
||||
.. note:: This only applies for userdata allocated by the VM, specified via sq_setclassudsize() or belonging to a userdata object.
|
||||
userpointers specified by the user are not affected by alignemnt rules.
|
||||
userpointers specified by the user are not affected by alignment rules.
|
||||
|
||||
.. _standalone_vm:
|
||||
|
||||
|
@ -23,7 +23,7 @@ When the function is called, the stackbase is the first parameter of the functio
|
||||
top is the last. In order to return a value the function has to push it in the stack and
|
||||
return 1.
|
||||
|
||||
Function parameters are in the stack from postion 1 ('this') to *n*.
|
||||
Function parameters are in the stack from position 1 ('this') to *n*.
|
||||
*sq_gettop()* can be used to determinate the number of parameters.
|
||||
|
||||
If the function has free variables, those will be in the stack after the explicit parameters
|
||||
|
@ -65,7 +65,7 @@ To force the stack to a certain size you can call *sq_settop* ::
|
||||
|
||||
void sq_settop(HSQUIRRELVM v,SQInteger newtop);
|
||||
|
||||
If the newtop is bigger than the previous one, the new posistions in the stack will be
|
||||
If the newtop is bigger than the previous one, the new positions in the stack will be
|
||||
filled with null values.
|
||||
|
||||
The following function pushes a C value into the stack::
|
||||
|
@ -17,7 +17,7 @@ Global Symbols
|
||||
.. js:function:: array(size,[fill])
|
||||
|
||||
create and returns array of a specified size.if the optional parameter fill is specified its
|
||||
value will be used to fill the new array's slots. If the fill paramter is omitted null is used instead.
|
||||
value will be used to fill the new array's slots. If the fill parameter is omitted null is used instead.
|
||||
|
||||
.. js:function:: seterrorhandler(func)
|
||||
|
||||
@ -36,7 +36,7 @@ sets the debug hook
|
||||
|
||||
.. js:function:: enabledebuginfo(enable)
|
||||
|
||||
enable/disable the debug line information generation at compile time. enable != null enables . enable == null disables.
|
||||
enable/disable the debug line information generation at compile time. enable != null enables. enable == null disables.
|
||||
|
||||
.. js:function:: getroottable()
|
||||
|
||||
@ -84,7 +84,7 @@ runs the garbage collector and returns an array containing all unreachable objec
|
||||
|
||||
.. js:function:: type(obj)
|
||||
|
||||
return the 'raw' type of an object without invoking the metatmethod '_typeof'.
|
||||
return the 'raw' type of an object without invoking the metamethod '_typeof'.
|
||||
|
||||
.. js:function:: getstackinfos(level)
|
||||
|
||||
@ -121,15 +121,15 @@ string values describing the version of VM and compiler.
|
||||
|
||||
.. js:data:: _charsize_
|
||||
|
||||
size in bytes of the internal VM rapresentation for characters(1 for ASCII builds 2 for UNICODE builds).
|
||||
size in bytes of the internal VM representation for characters(1 for ASCII builds 2 for UNICODE builds).
|
||||
|
||||
.. js:data:: _intsize_
|
||||
|
||||
size in bytes of the internal VM rapresentation for integers(4 for 32bits builds 8 for 64bits builds).
|
||||
size in bytes of the internal VM representation for integers(4 for 32bits builds 8 for 64bits builds).
|
||||
|
||||
.. js:data:: _floatsize_
|
||||
|
||||
size in bytes of the internal VM rapresentation for floats(4 for single precision builds 8 for double precision builds).
|
||||
size in bytes of the internal VM representation for floats(4 for single precision builds 8 for double precision builds).
|
||||
|
||||
-----------------
|
||||
Default delegates
|
||||
@ -158,7 +158,7 @@ returns the value of the integer(dummy function)
|
||||
|
||||
.. js:function:: integer.tochar()
|
||||
|
||||
returns a string containing a single character rapresented by the integer.
|
||||
returns a string containing a single character represented by the integer.
|
||||
|
||||
|
||||
.. js:function:: integer.weakref()
|
||||
@ -186,7 +186,7 @@ converts the number to string and returns it
|
||||
|
||||
.. js:function:: float.tochar()
|
||||
|
||||
returns a string containing a single character rapresented by the integer part of the float.
|
||||
returns a string containing a single character represented by the integer part of the float.
|
||||
|
||||
|
||||
.. js:function:: float.weakref()
|
||||
@ -285,12 +285,12 @@ sets the slot 'key' with the value 'val' without employing delegation. If the sl
|
||||
|
||||
.. js:function:: table.rawdelete()
|
||||
|
||||
deletes the slot key without emplying delegetion and retunrs his value. if the slo does not exists returns always null.
|
||||
deletes the slot key without employing delegation and returns his value. if the slo does not exists returns always null.
|
||||
|
||||
|
||||
.. js:function:: table.rawin(key)
|
||||
|
||||
returns true if the slot 'key' exists. the function has the same eddect as the operator 'in' but does not employ delegation.
|
||||
returns true if the slot 'key' exists. the function has the same effect as the operator 'in' but does not employ delegation.
|
||||
|
||||
|
||||
.. js:function:: table.weakref()
|
||||
@ -353,7 +353,7 @@ returns the value of the array with the higher index
|
||||
|
||||
.. js:function:: array.insert(idx,val)
|
||||
|
||||
inserst the value 'val' at the position 'idx' in the array
|
||||
inserts the value 'val' at the position 'idx' in the array
|
||||
|
||||
|
||||
.. js:function:: array.remove(idx)
|
||||
@ -363,12 +363,12 @@ removes the value at the position 'idx' in the array
|
||||
|
||||
.. js:function:: array.resize(size,[fill])
|
||||
|
||||
resizes the array, if the optional parameter fill is specified its value will be used to fill the new array's slots(if the size specified is bigger than the previous size) . If the fill paramter is omitted null is used instead.
|
||||
resizes the array, if the optional parameter fill is specified its value will be used to fill the new array's slots (if the size specified is bigger than the previous size). If the fill parameter is omitted null is used instead.
|
||||
|
||||
|
||||
.. js:function:: array.sort([compare_func])
|
||||
|
||||
sorts the array. a custom compare function can be optionally passed.The function prototype as to be the following.::
|
||||
sorts the array. A custom compare function can be optionally passed. The function prototype as to be the following.::
|
||||
|
||||
function custom_compare(a,b)
|
||||
{
|
||||
@ -420,7 +420,7 @@ for each element in the array invokes the function 'func' and replace the origin
|
||||
|
||||
.. js:function:: array.reduce(func(prevval,curval))
|
||||
|
||||
Reduces an array to a single value. For each element in the array invokes the function 'func' passing the initial value (or value from the previous callback call) and the value of the current element. the return value of the function is then used as 'prevval' for the next element. Given an array of length 0, returns null. Given an array of length 1, returns the first element. Given an array with 2 or more elements calls the function with the first two elements as the parameters, gets that result, then calls the function with that result and the third element, gets that result, calls the function with that result and the fourth parameter and so on until all element have been processed. Finally returns the return value of the last invocation of func.
|
||||
Reduces an array to a single value. For each element in the array invokes the function 'func' passing the initial value (or value from the previous callback call) and the value of the current element. the return value of the function is then used as 'prevval' for the next element. Given an array of length 0, returns null. Given an array of length 1, returns the first element. Given an array with 2 or more elements calls the function with the first two elements as the parameters, gets that result, then calls the function with that result and the third element, gets that result, calls the function with that result and the fourth parameter and so on until all element have been processed. Finally, returns the return value of the last invocation of func.
|
||||
|
||||
|
||||
.. js:function:: array.filter(func(index,val))
|
||||
@ -478,7 +478,7 @@ returns the root table of the closure
|
||||
|
||||
.. js:function:: array.bindenv(env)
|
||||
|
||||
clones the function(aka closure) and bind the enviroment object to it(table,class or instance). the this parameter of the newly create function will always be set to env. Note that the created function holds a weak reference to its environment object so cannot be used to control its lifetime.
|
||||
clones the function(aka closure) and bind the environment object to it(table,class or instance). the this parameter of the newly create function will always be set to env. Note that the created function holds a weak reference to its environment object so cannot be used to control its lifetime.
|
||||
|
||||
|
||||
.. js:function:: array.getinfos()
|
||||
@ -511,7 +511,7 @@ Class
|
||||
|
||||
.. js:function:: class.instance()
|
||||
|
||||
returns a new instance of the class. this function does not invoke the instance constructor. The constructor must be explicitly called( eg. class_inst.constructor(class_inst) ).
|
||||
returns a new instance of the class. this function does not invoke the instance constructor. The constructor must be explicitly called (eg. class_inst.constructor(class_inst) ).
|
||||
|
||||
|
||||
.. js:function:: class.getattributes(membername)
|
||||
@ -526,7 +526,7 @@ sets the attribute of the specified member and returns the previous attribute va
|
||||
|
||||
.. js:function:: class.rawin(key)
|
||||
|
||||
returns true if the slot 'key' exists. the function has the same eddect as the operator 'in' but does not employ delegation.
|
||||
returns true if the slot 'key' exists. the function has the same effect as the operator 'in' but does not employ delegation.
|
||||
|
||||
|
||||
.. js:function:: class.weakref()
|
||||
@ -546,7 +546,7 @@ tries to get a value from the slot 'key' without employing delegation
|
||||
|
||||
.. js:function:: class.rawset(key,val)
|
||||
|
||||
sets the slot 'key' with the value 'val' without employing delegation. If the slot does not exists , it will be created.
|
||||
sets the slot 'key' with the value 'val' without employing delegation. If the slot does not exists, it will be created.
|
||||
|
||||
|
||||
.. js:function:: class.newmember(key,val,[attrs],[bstatic])
|
||||
@ -556,7 +556,7 @@ sets/adds the slot 'key' with the value 'val' and attributes 'attrs' and if pres
|
||||
|
||||
.. js:function:: class.rawnewmember(key,val,[attrs],[bstatic])
|
||||
|
||||
sets/adds the slot 'key' with the value 'val' and attributes 'attrs'.If bstatic is true the slot will be added as static. If the slot does not exists , it will be created. It doesn't invoke any metamethod.
|
||||
sets/adds the slot 'key' with the value 'val' and attributes 'attrs'. If bstatic is true the slot will be added as static. If the slot does not exist, it will be created. It doesn't invoke any metamethod.
|
||||
|
||||
^^^^^^^^^^^^^^
|
||||
Class Instance
|
||||
@ -571,7 +571,7 @@ returns the class that created the instance.
|
||||
|
||||
:param key: ze key
|
||||
|
||||
returns true if the slot 'key' exists. the function has the same eddect as the operator 'in' but does not employ delegation.
|
||||
returns true if the slot 'key' exists. the function has the same effect as the operator 'in' but does not employ delegation.
|
||||
|
||||
|
||||
.. js:function:: instance.weakref()
|
||||
@ -581,7 +581,7 @@ returns a weak reference to the object.
|
||||
|
||||
.. js:function:: instance.tostring()
|
||||
|
||||
tries to invoke the _tostring metamethod, if failed. returns "(insatnce : pointer)".
|
||||
tries to invoke the _tostring metamethod, if failed. returns "(instance : pointer)".
|
||||
|
||||
|
||||
.. js:function:: instance.rawget(key)
|
||||
@ -591,7 +591,7 @@ tries to get a value from the slot 'key' without employing delegation
|
||||
|
||||
.. js:function:: instance.rawset(key,val)
|
||||
|
||||
sets the slot 'key' with the value 'val' without employing delegation. If the slot does not exists , it will be created.
|
||||
sets the slot 'key' with the value 'val' without employing delegation. If the slot does not exists, it will be created.
|
||||
|
||||
^^^^^^^^^^^^^^
|
||||
Generator
|
||||
@ -656,7 +656,7 @@ Weak Reference
|
||||
|
||||
.. js:function:: weakreference.ref()
|
||||
|
||||
returns the object that the weak reference is pointing at, null if the object that was point at was destroyed.
|
||||
returns the object that the weak reference is pointing at; null if the object that was point at was destroyed.
|
||||
|
||||
|
||||
.. js:function:: weakreference.weakref()
|
||||
|
@ -214,7 +214,7 @@ class declaration. The values are copied verbatim, *no cloning is performed* eve
|
||||
|
||||
.. note:: FOR C# and Java programmers:
|
||||
|
||||
Squirrel doesn't clone member's default values nor executes the member declaration for each instace(as C# or java).
|
||||
Squirrel doesn't clone member's default values nor executes the member declaration for each instance(as C# or java).
|
||||
|
||||
So consider this example: ::
|
||||
|
||||
@ -226,8 +226,8 @@ class declaration. The values are copied verbatim, *no cloning is performed* eve
|
||||
local a = Foo();
|
||||
local b = Foo();
|
||||
|
||||
In the snippet above both instances will refer to the same array and same table.To archieve what a C# or Java programmer would
|
||||
exepect, the following approach should be taken. ::
|
||||
In the snippet above both instances will refer to the same array and same table.To achieve what a C# or Java programmer would
|
||||
expect, the following approach should be taken. ::
|
||||
|
||||
class Foo {
|
||||
myarray = null
|
||||
@ -327,7 +327,7 @@ Here an example: ::
|
||||
}
|
||||
}
|
||||
|
||||
Same rule apply to the constructor. The constructor is a regular function (apart from being automatically invoked on contruction).::
|
||||
Same rule apply to the constructor. The constructor is a regular function (apart from being automatically invoked on construction).::
|
||||
|
||||
class BaseClass {
|
||||
constructor()
|
||||
|
@ -2,16 +2,16 @@
|
||||
|
||||
|
||||
========================
|
||||
Constants & Enumarations
|
||||
Constants & Enumerations
|
||||
========================
|
||||
|
||||
.. index::
|
||||
single: Constants & Enumarations
|
||||
single: Constants & Enumerations
|
||||
|
||||
|
||||
|
||||
Squirrel allows to bind constant values to an identifier that will be evaluated compile-time.
|
||||
This is archieved though constants and enumarations.
|
||||
This is achieved though constants and Enumerations.
|
||||
|
||||
---------------
|
||||
Constants
|
||||
@ -20,7 +20,7 @@ Constants
|
||||
.. index::
|
||||
single: Constants
|
||||
|
||||
Constants bind a specific value to an indentifier. Constants are similar to
|
||||
Constants bind a specific value to an identifier. Constants are similar to
|
||||
global values, except that they are evaluated compile time and their value cannot be changed.
|
||||
|
||||
constants values can only be integers, floats or string literals. No expression are allowed.
|
||||
@ -28,7 +28,7 @@ are declared with the following syntax.::
|
||||
|
||||
const foobar = 100;
|
||||
const floatbar = 1.2;
|
||||
const stringbar = "I'm a contant string";
|
||||
const stringbar = "I'm a constant string";
|
||||
|
||||
constants are always globally scoped, from the moment they are declared, any following code
|
||||
can reference them.
|
||||
@ -73,7 +73,7 @@ Enumerations will shadow any global slot with the same name( the global slot wil
|
||||
Implementation notes
|
||||
--------------------
|
||||
|
||||
Enumerations and Contants are a compile-time feature. Only integers, string and floats can be declared as const/enum;
|
||||
Enumerations and Constants are a compile-time feature. Only integers, string and floats can be declared as const/enum;
|
||||
No expressions are allowed(because they would have to be evaluated compile time).
|
||||
When a const or an enum is declared, it is added compile time to the ``consttable``. This table is stored in the VM shared state
|
||||
and is shared by the VM and all its threads.
|
||||
|
@ -122,8 +122,7 @@ Class Instance
|
||||
--------------
|
||||
|
||||
Class instances are created by calling a *class object*. Instances, as tables, are
|
||||
implemented as pair of key/value. Instances members cannot be dyncamically added or removed however
|
||||
the value of the members can be changed.
|
||||
implemented as pair of key/value. Instances members cannot be dynamically added or removed; however the value of the members can be changed.
|
||||
|
||||
|
||||
|
||||
@ -152,7 +151,7 @@ Threads are objects that represents a cooperative thread of execution, also know
|
||||
Weak Reference
|
||||
--------------
|
||||
|
||||
Weak References are objects that point to another(non scalar) object but do not own a strong reference to it.
|
||||
Weak References are objects that point to another (non-scalar) object but do not own a strong reference to it.
|
||||
(See :ref:`Weak References <weak_references>`).
|
||||
|
||||
|
||||
|
@ -50,7 +50,7 @@ with tables we can also use the '.' syntax::
|
||||
_table.foo
|
||||
|
||||
Squirrel first checks if an identifier is a local variable (function arguments are local
|
||||
variables) if not looks up the environment object (this) and finally looksup
|
||||
variables) if not looks up the environment object (this) and finally looks up
|
||||
to the closure root.
|
||||
|
||||
For instance:::
|
||||
|
@ -172,7 +172,7 @@ _tyoeof
|
||||
|
||||
_tyoeof()
|
||||
|
||||
invoked by the typeof operator on tables ,userdata and class instances
|
||||
invoked by the typeof operator on tables, userdata and class instances
|
||||
|
||||
returns the type of ``this`` as string
|
||||
|
||||
@ -206,7 +206,7 @@ _call
|
||||
|
||||
_call(other)
|
||||
|
||||
invoked when a table, userdata or class instance is called
|
||||
invoked when a table, userdata, or class instance is called
|
||||
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
_cloned
|
||||
@ -239,7 +239,7 @@ _tostring
|
||||
|
||||
_tostring(previdx)
|
||||
|
||||
invoked when during string conacatenation or when the ``print`` function prints a table, instance or userdata.
|
||||
invoked when during string conacatenation or when the ``print`` function prints a table, instance, or userdata.
|
||||
The method is also invoked by the sq_tostring() api
|
||||
|
||||
must return a string representation of the object.
|
||||
|
@ -52,7 +52,7 @@ true and false
|
||||
single: true
|
||||
single: false
|
||||
|
||||
Squirrel has a boolean type(bool) however like C++ it considers null, 0(integer) and 0.0(float)
|
||||
Squirrel has a boolean type (bool) however like C++ it considers null, 0(integer) and 0.0(float)
|
||||
as *false*, any other value is considered *true*.
|
||||
|
||||
^^^^^^^^^^^^^^^^^
|
||||
@ -326,7 +326,7 @@ try/catch
|
||||
stat:= 'try' stat 'catch' '(' id ')' stat
|
||||
|
||||
The try statement encloses a block of code in which an exceptional condition can occur,
|
||||
such as a runtime error or a throw statement. The catch clause provides the exceptionhandling
|
||||
such as a runtime error or a throw statement. The catch clause provides the exception-handling
|
||||
code. When a catch clause catches an exception, its id is bound to that
|
||||
exception.
|
||||
|
||||
|
@ -18,7 +18,7 @@ through this type; even the environment, where "global" variables are stored, is
|
||||
Construction
|
||||
------------------
|
||||
|
||||
Tables are created through the table constructor (see :ref:`Table constructor <table_contructor>`)
|
||||
Tables are created through the table constructor (see :ref:`Table constructor <table_constructor>`)
|
||||
|
||||
------------------
|
||||
Slot creation
|
||||
|
@ -22,17 +22,17 @@ Using threads
|
||||
------------------
|
||||
|
||||
.. index::
|
||||
single: Usign Threads
|
||||
single: Using Threads
|
||||
|
||||
Threads are created through the built-in function 'newthread(func)'; this function
|
||||
gets as parameter a squirrel function and bind it to the new thread objecs(will be the thread body).
|
||||
gets as parameter a squirrel function and bind it to the new thread objects (will be the thread body).
|
||||
The returned thread object is initially in 'idle' state. the thread can be started with the function
|
||||
'threadobj.call()'; the parameters passed to 'call' are passed to the thread function.
|
||||
|
||||
A thread can be be suspended calling the function suspend(), when this happens the function
|
||||
that wokeup(or started) the thread returns (If a parametrer is passed to suspend() it will
|
||||
that wokeup(or started) the thread returns (If a parameter is passed to suspend() it will
|
||||
be the return value of the wakeup function , if no parameter is passed the return value will be null).
|
||||
A suspended thread can be resumed calling the funtion 'threadobj.wakeup', when this happens
|
||||
A suspended thread can be resumed calling the function 'threadobj.wakeup', when this happens
|
||||
the function that suspended the thread will return(if a parameter is passed to wakeup it will
|
||||
be the return value of the suspend function, if no parameter is passed the return value will be null).
|
||||
|
||||
|
@ -12,7 +12,7 @@ Weak References
|
||||
The weak references allows the programmers to create references to objects without
|
||||
influencing the lifetime of the object itself.
|
||||
In squirrel Weak references are first-class objects created through the built-in method obj.weakref().
|
||||
All types except null implement the weakref() method; however in bools,integers and float the method
|
||||
All types except null implement the weakref() method; however in bools, integers, and floats the method
|
||||
simply returns the object itself(this because this types are always passed by value).
|
||||
When a weak references is assigned to a container (table slot,array,class or
|
||||
instance) is treated differently than other objects; When a container slot that hold a weak
|
||||
|
@ -4,7 +4,7 @@
|
||||
The Blob library
|
||||
==================
|
||||
The blob library implements binary data manipulations routines. The library is
|
||||
based on `blob objects` that rapresent a buffer of arbitrary
|
||||
based on `blob objects` that represent a buffer of arbitrary
|
||||
binary data.
|
||||
|
||||
---------------
|
||||
@ -66,20 +66,20 @@ A blob can also be accessed byte by byte through the `[]` operator.
|
||||
|
||||
:param int size: number of bytes to read
|
||||
|
||||
read n bytes from the stream and retuns them as blob
|
||||
read n bytes from the stream and returns them as blob
|
||||
|
||||
.. js:function:: blob.readn(type)
|
||||
|
||||
:param int type: type of the number to read
|
||||
|
||||
reads a number from the stream according to the type pameter.
|
||||
reads a number from the stream according to the type parameter.
|
||||
|
||||
`type` can have the following values:
|
||||
|
||||
+--------------+--------------------------------------------------------------------------------+----------------------+
|
||||
| parameter | return description | return type |
|
||||
+==============+================================================================================+======================+
|
||||
| 'l' | processor dependent, 32bits on 32bits processors, 64bits on 64bits prcessors | integer |
|
||||
| 'l' | processor dependent, 32bits on 32bits processors, 64bits on 64bits processors | integer |
|
||||
+--------------+--------------------------------------------------------------------------------+----------------------+
|
||||
| 'i' | 32bits number | integer |
|
||||
+--------------+--------------------------------------------------------------------------------+----------------------+
|
||||
@ -98,7 +98,7 @@ A blob can also be accessed byte by byte through the `[]` operator.
|
||||
|
||||
.. js:function:: blob.resize(size)
|
||||
|
||||
:param int size: the new size of the blobl in bytes
|
||||
:param int size: the new size of the blob in bytes
|
||||
|
||||
resizes the blob to the specified `size`
|
||||
|
||||
@ -142,7 +142,7 @@ A blob can also be accessed byte by byte through the `[]` operator.
|
||||
:param number n: the value to be written
|
||||
:param int type: type of the number to write
|
||||
|
||||
writes a number in the stream formatted according to the `type` pameter
|
||||
writes a number in the stream formatted according to the `type` parameter
|
||||
|
||||
`type` can have the following values:
|
||||
|
||||
|
@ -22,7 +22,7 @@ Global Symbols
|
||||
if the optional parameter 'raiseerror' is true, the compiler error handler is invoked
|
||||
in case of a syntax error. If raiseerror is omitted or set to false, the compiler
|
||||
error handler is not invoked.
|
||||
When squirrel is compiled in unicode mode the function can handle different character encodings,
|
||||
When squirrel is compiled in Unicode mode the function can handle different character encodings,
|
||||
UTF8 with and without prefix and UCS-2 prefixed(both big endian an little endian).
|
||||
If the source stream is not prefixed UTF8 encoding is used as default.
|
||||
|
||||
@ -32,7 +32,7 @@ Global Symbols
|
||||
if the optional parameter 'raiseerror' is true, the compiler error handler is invoked
|
||||
in case of a syntax error. If raiseerror is omitted or set to false, the compiler
|
||||
error handler is not invoked.
|
||||
When squirrel is compiled in unicode mode the function can handle different character encodings,
|
||||
When squirrel is compiled in Unicode mode the function can handle different character encodings,
|
||||
UTF8 with and without prefix and UCS-2 prefixed(both big endian an little endian).
|
||||
If the source stream is not prefixed UTF8 encoding is used as default.
|
||||
|
||||
@ -63,7 +63,7 @@ The file class
|
||||
|
||||
.. js:class:: file(path, patten)
|
||||
|
||||
It's contructor imitates the behaviour of the C runtime function fopen for eg. ::
|
||||
It's constructor imitates the behaviour of the C runtime function fopen for eg. ::
|
||||
|
||||
local myfile = file("test.xxx","wb+");
|
||||
|
||||
@ -79,7 +79,7 @@ The file class
|
||||
|
||||
.. js:function:: file.flush()
|
||||
|
||||
flushes the stream.return a value != null if succeded, otherwise returns null
|
||||
flushes the stream.return a value != null if succeeded, otherwise returns null
|
||||
|
||||
.. js:function:: file.len()
|
||||
|
||||
@ -89,20 +89,20 @@ The file class
|
||||
|
||||
:param int size: number of bytes to read
|
||||
|
||||
read n bytes from the stream and retuns them as blob
|
||||
read n bytes from the stream and returns them as blob
|
||||
|
||||
.. js:function:: file.readn(type)
|
||||
|
||||
:param int type: type of the number to read
|
||||
|
||||
reads a number from the stream according to the type pameter.
|
||||
reads a number from the stream according to the type parameter.
|
||||
|
||||
`type` can have the following values:
|
||||
|
||||
+--------------+--------------------------------------------------------------------------------+----------------------+
|
||||
| parameter | return description | return type |
|
||||
+==============+================================================================================+======================+
|
||||
| 'l' | processor dependent, 32bits on 32bits processors, 64bits on 64bits prcessors | integer |
|
||||
| 'l' | processor dependent, 32bits on 32bits processors, 64bits on 64bits processors | integer |
|
||||
+--------------+--------------------------------------------------------------------------------+----------------------+
|
||||
| 'i' | 32bits number | integer |
|
||||
+--------------+--------------------------------------------------------------------------------+----------------------+
|
||||
@ -121,7 +121,7 @@ The file class
|
||||
|
||||
.. js:function:: file.resize(size)
|
||||
|
||||
:param int size: the new size of the blobl in bytes
|
||||
:param int size: the new size of the blob in bytes
|
||||
|
||||
resizes the blob to the specified `size`
|
||||
|
||||
@ -157,7 +157,7 @@ The file class
|
||||
:param number n: the value to be written
|
||||
:param int type: type of the number to write
|
||||
|
||||
writes a number in the stream formatted according to the `type` pameter
|
||||
writes a number in the stream formatted according to the `type` pamraeter
|
||||
|
||||
`type` can have the following values:
|
||||
|
||||
@ -230,7 +230,7 @@ Script loading and serialization
|
||||
:returns: an SQRESULT
|
||||
|
||||
Compiles a squirrel script or loads a precompiled one an pushes it as closure in the stack.
|
||||
When squirrel is compiled in unicode mode the function can handle different character encodings,
|
||||
When squirrel is compiled in Unicode mode the function can handle different character encodings,
|
||||
UTF8 with and without prefix and UCS-2 prefixed(both big endian an little endian).
|
||||
If the source stream is not prefixed UTF8 encoding is used as default.
|
||||
|
||||
@ -241,13 +241,13 @@ Script loading and serialization
|
||||
:param SQBool retval: if true the function will push the return value of the executed script in the stack.
|
||||
:param SQBool printerror: if true the compiler error handler will be called if a error occurs
|
||||
:returns: an SQRESULT
|
||||
:remarks: the function aspects a table on top of the stack that will be used as 'this' for the execution of the script. The 'this' parameter is left untouched in the stack.
|
||||
:remarks: the function expects a table on top of the stack that will be used as 'this' for the execution of the script. The 'this' parameter is left untouched in the stack.
|
||||
|
||||
Compiles a squirrel script or loads a precompiled one and executes it.
|
||||
Optionally pushes the return value of the executed script in the stack.
|
||||
When squirrel is compiled in unicode mode the function can handle different character encodings,
|
||||
UTF8 with and without prefix and UCS-2 prefixed(both big endian an little endian).
|
||||
If the source stream is not prefixed UTF8 encoding is used as default. ::
|
||||
If the source stream is not prefixed, UTF8 encoding is used as default. ::
|
||||
|
||||
sq_pushroottable(v); //push the root table(were the globals of the script will are stored)
|
||||
sqstd_dofile(v, _SC("test.nut"), SQFalse, SQTrue);// also prints syntax errors if any
|
||||
@ -259,6 +259,6 @@ Script loading and serialization
|
||||
:returns: an SQRESULT
|
||||
|
||||
serializes the closure at the top position in the stack as bytecode in
|
||||
the file specified by the paremeter filename. If a file with the
|
||||
the file specified by the parameter filename. If a file with the
|
||||
same name already exists, it will be overwritten.
|
||||
|
||||
|
@ -42,7 +42,7 @@ Global Symbols
|
||||
Strips white-space-only characters that might appear at the end of the given string
|
||||
and returns the new stripped string.
|
||||
|
||||
.. js:function:: split(str, separtators)
|
||||
.. js:function:: split(str, separators)
|
||||
|
||||
returns an array of strings split at each point where a separator character occurs in `str`.
|
||||
The separator is not returned as part of any array element.
|
||||
@ -69,7 +69,7 @@ The regexp class
|
||||
|
||||
.. js:class:: regexp(pattern)
|
||||
|
||||
The regexp object rapresent a precompiled regular experssion pattern. The object is created
|
||||
The regexp object represent a precompiled regular expression pattern. The object is created
|
||||
trough `regexp(patern)`.
|
||||
|
||||
|
||||
@ -140,19 +140,19 @@ The regexp class
|
||||
+---------------------+--------------------------------------+
|
||||
| `\\d` | digits |
|
||||
+---------------------+--------------------------------------+
|
||||
| `\\D` | non nondigits |
|
||||
| `\\D` | non digits |
|
||||
+---------------------+--------------------------------------+
|
||||
| `\\x` | exadecimal digits |
|
||||
| `\\x` | hexadecimal digits |
|
||||
+---------------------+--------------------------------------+
|
||||
| `\\X` | non exadecimal digits |
|
||||
| `\\X` | non hexadecimal digits |
|
||||
+---------------------+--------------------------------------+
|
||||
| `\\c` | control characters |
|
||||
+---------------------+--------------------------------------+
|
||||
| `\\C` | non control characters |
|
||||
+---------------------+--------------------------------------+
|
||||
| `\\p` | punctation |
|
||||
| `\\p` | punctuation |
|
||||
+---------------------+--------------------------------------+
|
||||
| `\\P` | non punctation |
|
||||
| `\\P` | non punctuation |
|
||||
+---------------------+--------------------------------------+
|
||||
| `\\b` | word boundary |
|
||||
+---------------------+--------------------------------------+
|
||||
@ -195,7 +195,7 @@ The regexp class
|
||||
|
||||
.. js:function:: regexp.search(str [, start])
|
||||
|
||||
returns a table containing two indexs("begin" and "end") of the first match of the regular expression in
|
||||
returns a table containing two indexes ("begin" and "end") of the first match of the regular expression in
|
||||
the string `str`, otherwise if no match occurs returns null. The search starts from the index `start`
|
||||
of the string, if `start` is omitted the search starts from the beginning of the string.
|
||||
|
||||
@ -275,7 +275,7 @@ Regular Expessions
|
||||
:param SQChar** out_end: a pointer to a string pointer that will be set with the end of the match
|
||||
:returns: SQTrue if successful otherwise SQFalse
|
||||
|
||||
searches the first match of the expressin in the string specified in the parameter text.
|
||||
searches the first match of the expression in the string specified in the parameter text.
|
||||
if the match is found returns SQTrue and the sets out_begin to the beginning of the
|
||||
match and out_end at the end of the match; otherwise returns SQFalse.
|
||||
|
||||
@ -288,7 +288,7 @@ Regular Expessions
|
||||
:param SQChar** out_end: a pointer to a string pointer that will be set with the end of the match
|
||||
:returns: SQTrue if successful otherwise SQFalse
|
||||
|
||||
searches the first match of the expressin in the string delimited
|
||||
searches the first match of the expression in the string delimited
|
||||
by the parameter text_begin and text_end.
|
||||
if the match is found returns SQTrue and the sets out_begin to the beginning of the
|
||||
match and out_end at the end of the match; otherwise returns SQFalse.
|
||||
@ -308,4 +308,4 @@ Regular Expessions
|
||||
:returns: the function returns SQTrue if n is valid index otherwise SQFalse.
|
||||
|
||||
retrieve the begin and and pointer to the length of the sub expression indexed
|
||||
by n. The result is passed trhough the struct SQRexMatch.
|
||||
by n. The result is passed through the struct SQRexMatch.
|
||||
|
@ -21,7 +21,7 @@ Global Symbols
|
||||
|
||||
.. js:function:: date([time [, format]])
|
||||
|
||||
returns a table containing a date/time splitted in the slots:
|
||||
returns a table containing a date/time split into the slots:
|
||||
|
||||
+-------------+----------------------------------------+
|
||||
| sec | Seconds after minute (0 - 59). |
|
||||
|
Loading…
Reference in New Issue
Block a user