commit
f8f229fa00
@ -177,7 +177,7 @@ gets the value of the integer at the idx position in the stack.
|
||||
:param SQInteger idx: an index in the stack pointing to the class
|
||||
:param HSQMEMBERHANDLE* handle: a pointer to the variable that will store the handle
|
||||
:returns: a SQRESULT
|
||||
:remarks: This method works only with classes and instances. A handle retrieved through a class can be later used to set or get values from one of the class instances and vice-versa. Handles retrieved from base classes are still valid in derived classes and respect inheritance rules.
|
||||
: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().
|
||||
|
||||
@ -455,7 +455,7 @@ pushes a null value into the stack
|
||||
|
||||
:param HSQUIRRELVM v: the target VM
|
||||
:param const SQChar * s: pointer to the string that has to be pushed
|
||||
:param SQInteger len: lenght of the string pointed by s
|
||||
:param SQInteger len: length of the string pointed by s
|
||||
:remarks: if the parameter len is less than 0 the VM will calculate the length using strlen(s)
|
||||
|
||||
pushes a string in the stack
|
||||
|
@ -13,7 +13,7 @@ Stack Operations
|
||||
:returns: == 0 if obj1==obj2
|
||||
:returns: < 0 if obj1<obj2
|
||||
|
||||
compares 2 object from the stack and compares them.
|
||||
compares 2 object from the top of the stack. obj2 should be pushed before obj1.
|
||||
|
||||
|
||||
|
||||
@ -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 memtamethod 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 situatuation has to be considered a "stack overflow".
|
||||
|
||||
|
||||
|
||||
|
@ -47,7 +47,7 @@ To get a value from an array or table::
|
||||
|
||||
SQRESULT sq_get(HSQUIRRELVM v,SQInteger idx);
|
||||
|
||||
To get or set a value from a table without employ delegation::
|
||||
To get or set a value from a table without employing delegation::
|
||||
|
||||
SQRESULT sq_rawget(HSQUIRRELVM v,SQInteger idx);
|
||||
SQRESULT sq_rawset(HSQUIRRELVM v,SQInteger idx);
|
||||
|
@ -37,17 +37,17 @@ Constants will shadow any global slot with the same name( the global slot will r
|
||||
local x = foobar * 2;
|
||||
|
||||
---------------
|
||||
Enumrations
|
||||
Enumerations
|
||||
---------------
|
||||
|
||||
.. index::
|
||||
single: Enumrations
|
||||
single: Enumerations
|
||||
|
||||
As Constants, Enumerations bind a specific value to a name. Enumerations are also evaluated compile time
|
||||
As Constants, Enumerations bind a specific value to a name. Enumerations are also evaluated at compile time
|
||||
and their value cannot be changed.
|
||||
|
||||
An enum declaration introduces a new enumeration into the program.
|
||||
Enumerations values can only be integers, floats or string literals. No expression are allowed.::
|
||||
Enumeration values can only be integers, floats or string literals. No expression are allowed.::
|
||||
|
||||
enum Stuff {
|
||||
first, //this will be 0
|
||||
|
@ -6,11 +6,11 @@ Metamethods
|
||||
|
||||
Metamethods are a mechanism that allows the customization of certain aspects of the
|
||||
language semantics. Those methods are normal functions placed in a table
|
||||
parent(delegate) or class declaration; Is possible to change many aspect of a table/class instance behavior by just defining
|
||||
a metamethod. Class objects(not instances) supports only 2 metamethods ``_newmember, _inherited`` .
|
||||
parent(delegate) or class declaration; It is possible to change many aspects of a table/class instance behavior by just defining
|
||||
a metamethod. Class objects (not instances) support only 2 metamethods ``_newmember, _inherited`` .
|
||||
|
||||
For example when we use relational operators other than '==' on 2 tables, the VM will
|
||||
check if the table has a method in his parent called '_cmp' if so it will call it to determine
|
||||
check if the table has a method in his parent called '_cmp'; if so it will call it to determine
|
||||
the relation between the tables.::
|
||||
|
||||
local comparable={
|
||||
@ -64,7 +64,7 @@ _set
|
||||
|
||||
invoked when the index idx is not present in the object or in its delegate chain.
|
||||
``_set`` must 'throw null' to notify that a key wasn't found but the there were not runtime errors(clean failure).
|
||||
This allows the program to defferentieate between a runtime error and a 'index not found'.
|
||||
This allows the program to differentiate between a runtime error and a 'index not found'.
|
||||
|
||||
^^^^^
|
||||
_get
|
||||
@ -72,11 +72,11 @@ _get
|
||||
|
||||
::
|
||||
|
||||
_get(idx,val)
|
||||
_get(idx)
|
||||
|
||||
invoked when the index idx is not present in the object or in its delegate chain.
|
||||
_get must 'throw null' to notify that a key wasn't found but the there were not runtime errors(clean failure).
|
||||
This allows the program to defferentieate between a runtime error and a 'index not found'.
|
||||
This allows the program to differentiate between a runtime error and a 'index not found'.
|
||||
|
||||
^^^^^^^^^
|
||||
_newslot
|
||||
|
@ -60,7 +60,7 @@ A blob can also be accessed byte by byte through the `[]` operator.
|
||||
|
||||
.. js:function:: blob.len()
|
||||
|
||||
returns the lenght of the stream
|
||||
returns the length of the stream
|
||||
|
||||
.. js:function:: blob.readblob(size)
|
||||
|
||||
|
@ -21,20 +21,20 @@ Global Symbols
|
||||
returns the value returned by the script or null if no value is returned.
|
||||
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 ivoked.
|
||||
When squirrel is compiled in unicode mode the function can handle different character ecodings,
|
||||
error handler is not invoked.
|
||||
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 ecoding is used as default.
|
||||
If the source stream is not prefixed UTF8 encoding is used as default.
|
||||
|
||||
.. js:function:: loadfile(path, [raiseerror])
|
||||
|
||||
compiles a squirrel script or loads a precompiled one an returns it as as function.
|
||||
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 ivoked.
|
||||
When squirrel is compiled in unicode mode the function can handle different character ecodings,
|
||||
error handler is not invoked.
|
||||
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 ecoding is used as default.
|
||||
If the source stream is not prefixed UTF8 encoding is used as default.
|
||||
|
||||
.. js:function:: writeclosuretofile(destpath, closure)
|
||||
|
||||
@ -83,7 +83,7 @@ The file class
|
||||
|
||||
.. js:function:: file.len()
|
||||
|
||||
returns the lenght of the stream
|
||||
returns the length of the stream
|
||||
|
||||
.. js:function:: file.readblob(size)
|
||||
|
||||
@ -230,9 +230,9 @@ 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 ecodings,
|
||||
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 ecoding is used as default.
|
||||
If the source stream is not prefixed UTF8 encoding is used as default.
|
||||
|
||||
.. c:function:: SQRESULT sqstd_dofile(HSQUIRRELVM v, const SQChar* filename, SQBool retval, SQBool printerror)
|
||||
|
||||
@ -245,9 +245,9 @@ Script loading and serialization
|
||||
|
||||
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 ecodings,
|
||||
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 ecoding 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
|
||||
|
@ -372,7 +372,7 @@ SQRESULT sqstd_loadfile(HSQUIRRELVM v,const SQChar *filename,SQBool printerror)
|
||||
}
|
||||
if(uc != 0xBF) {
|
||||
sqstd_fclose(file);
|
||||
return sq_throwerror(v,_SC("Unrecognozed ecoding"));
|
||||
return sq_throwerror(v,_SC("Unrecognized encoding"));
|
||||
}
|
||||
#ifdef SQUNICODE
|
||||
func = _io_file_lexfeed_UTF8;
|
||||
|
@ -1128,7 +1128,7 @@ SQRESULT sq_reservestack(HSQUIRRELVM v,SQInteger nsize)
|
||||
{
|
||||
if (((SQUnsignedInteger)v->_top + nsize) > v->_stack.size()) {
|
||||
if(v->_nmetamethodscall) {
|
||||
return sq_throwerror(v,_SC("cannot resize stack while in a metamethod"));
|
||||
return sq_throwerror(v,_SC("cannot resize stack while in a metamethod"));
|
||||
}
|
||||
v->_stack.resize(v->_stack.size() + ((v->_top + nsize) - v->_stack.size()));
|
||||
}
|
||||
|
@ -1632,7 +1632,7 @@ bool SQVM::EnterFrame(SQInteger newbase, SQInteger newtop, bool tailcall)
|
||||
_top = newtop;
|
||||
if(newtop + MIN_STACK_OVERHEAD > (SQInteger)_stack.size()) {
|
||||
if(_nmetamethodscall) {
|
||||
Raise_Error(_SC("stack overflow, cannot resize stack while in a metamethod"));
|
||||
Raise_Error(_SC("stack overflow, cannot resize stack while in a metamethod"));
|
||||
return false;
|
||||
}
|
||||
_stack.resize(newtop + (MIN_STACK_OVERHEAD << 2));
|
||||
|
Loading…
x
Reference in New Issue
Block a user