Helper class that wraps a Squirrel virtual machine in a C++ API. More...
#include <sqratVM.h>
Public Types | |
enum | ERROR_STATE { SQRAT_NO_ERROR, SQRAT_COMPILE_ERROR, SQRAT_RUNTIME_ERROR } |
Public Member Functions | |
SqratVM (int initialStackSize=1024, unsigned char libsToLoad=LIB_ALL) | |
~SqratVM () | |
HSQUIRRELVM | GetVM () |
Sqrat::RootTable & | GetRootTable () |
Sqrat::Script & | GetScript () |
Sqrat::string | GetLastErrorMsg () |
void | SetLastErrorMsg (const Sqrat::string &str) |
void | SetPrintFunc (SQPRINTFUNCTION printFunc, SQPRINTFUNCTION errFunc) |
void | SetErrorHandler (SQFUNCTION runErr, SQCOMPILERERROR comErr) |
ERROR_STATE | DoString (const Sqrat::string &str) |
ERROR_STATE | DoFile (const Sqrat::string &file) |
Static Public Attributes | |
static const unsigned char | LIB_IO = 0x01 |
Input/Output library. | |
static const unsigned char | LIB_BLOB = 0x02 |
Blob library. | |
static const unsigned char | LIB_MATH = 0x04 |
Math library. | |
static const unsigned char | LIB_SYST = 0x08 |
System library. | |
static const unsigned char | LIB_STR = 0x10 |
String library. | |
static const unsigned char | LIB_ALL = LIB_IO | LIB_BLOB | LIB_MATH | LIB_SYST | LIB_STR |
All libraries. | |
Helper class that wraps a Squirrel virtual machine in a C++ API.
Enumeration representing the different types of errors that may occur within a SqratVM
Enumerator | |
---|---|
SQRAT_NO_ERROR |
For when no error has occurred. |
SQRAT_COMPILE_ERROR |
For when a script compiling error has occurred. |
SQRAT_RUNTIME_ERROR |
For when a script running error has occurred. |
|
inline |
Default constructor
initialStackSize | Initial size of the execution stack (if the stack is too small it will automatically grow) |
libsToLoad | Specifies what standard Squirrel libraries should be loaded |
|
inline |
Destructor
|
inline |
Runs a file containing a Squirrel script
file | File path containing a Squirrel script |
|
inline |
Runs a string containing a Squirrel script
str | String containing a Squirrel script |
|
inline |
Gets the error message for the most recent Squirrel error with the VM
|
inline |
Gets the root table for this VM
|
inline |
|
inline |
Gets the underlying Squirrel VM
|
inline |
Sets the Squirrel error handlers
runErr | A pointer to the runtime error handler func |
comErr | A pointer to the compile error handler func |
|
inline |
Overwrites the most recent Squirrel error for this VM
str | A nice error message |
|
inline |
Sets the print function of the virtual machine
printFunc | A pointer to the print func or NULL to disable the output |
errFunc | A pointer to the error func or NULL to disable the output |