sqstd_register_iolib |
SQRESULT sqstd_register_iolib(
HSQUIRRELVM v)
;
initialize and register the io library in the given VM.
- parameters:
-
- HSQUIRRELVM v
-
the target VM
- return:
-
an SQRESULT
- remarks:
-
The function aspects a table on top of the stack where to register the global library functions.
sqstd_createfile |
SQRESULT sqstd_createfile(
HSQUIRRELVM v, SQFILE file, SQBool own)
;
creates a file object bound to the SQFILE passed as parameter and pushes it in the stack
- parameters:
-
- HSQUIRRELVM v
-
the target VM
- SQFILE file
-
the stream that will be rapresented by the file object
- SQBool own
-
if different true the stream will be automatically closed when the newly create file object is destroyed.
- return:
-
an SQRESULT
sqstd_getfile |
SQRESULT sqstd_getfile(
HSQUIRRELVM v, SQInteger idx, SQFILE * file)
;
retrieve the pointer of a stream handle from an arbitrary position in the stack.
- parameters:
-
- HSQUIRRELVM v
-
the target VM
- SQInteger idx
-
and index in the stack
- SQFILE * file
-
A pointer to a SQFILE handle that will store the result
- return:
-
an SQRESULT
sqstd_loadfile |
SQRESULT sqstd_loadfile(
HSQUIRRELVM v, const SQChar * filename, SQBool printerror)
;
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, 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.
- parameters:
-
- HSQUIRRELVM v
-
the target VM
- const SQChar * filename
-
path of the script that has to be loaded
- SQBool printerror
-
if true the compiler error handler will be called if a error occurs.
- return:
-
an SQRESULT
sqstd_dofile |
SQRESULT sqstd_dofile(
HSQUIRRELVM v, const SQChar * filename, SQBool retval, SQBool printerror)
;
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, 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.
- parameters:
-
- HSQUIRRELVM v
-
the target VM
- const SQChar * filename
-
path of the script that has to be loaded
- SQBool retval
-
if true the function will push the return value of the executed script in the stack.
- SQBool printerror
-
if true the compiler error handler will be called if a error occurs.
- return:
-
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.
- eg.
-
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
sqstd_writeclosuretofile |
SQRESULT sqstd_writeclosuretofile(
HSQUIRRELVM v, const SQChar * filename)
;
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 same name already exists, it will be overwritten.
- parameters:
-
- HSQUIRRELVM v
-
the target VM
- const SQChar * filename
-
path of the script that has to be loaded
- return:
-
an SQRESULT