QScript

to execute a script, or use a script as a library

Constructors

this
this(string scriptName, bool autoImport, Library[] libraries, bool defaultLibs, bool extraLibs)

constructor.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

addEnum
integer addEnum(Enum )
Undocumented in source. Be warned that the author may not have intended to support it.
addFunction
integer addFunction(Function )
Undocumented in source. Be warned that the author may not have intended to support it.
addStruct
integer addStruct(Struct )
Undocumented in source. Be warned that the author may not have intended to support it.
addVar
integer addVar(Variable )
Undocumented in source. Be warned that the author may not have intended to support it.
compileScript
QScriptBytecode compileScript(string[] script, CompileError[] errors)

compiles a script, and prepares it for execution with this class

compileScript
CompileError[] compileScript(string[] script)

compiles a script, and prepares it for execution with this class

execute
NaData execute(uinteger functionId, NaData[] args)

Executes a function from script

getVar
NaData getVar(uinteger varId)
Undocumented in source. Be warned that the author may not have intended to support it.
getVarRef
NaData getVarRef(uinteger varId)
Undocumented in source. Be warned that the author may not have intended to support it.
load
bool load(QScriptBytecode bytecode, string[] errors)

Loads bytecode and library info

Inherited Members

From Library

_autoImport
bool _autoImport;

if this library is automatically imported

_name
string _name;

name of library

_functions
Function[] _functions;

functions exported by library. The index is function ID.

_vars
Variable[] _vars;

global variables exported by this library. index is ID

_structs
Struct[] _structs;

structs exported by library

_enums
Enum[] _enums;

Enums exported by library

autoImport
bool autoImport [@property getter]

if this library is automatically imported

name
string name [@property getter]

library name

functions
Function[] functions [@property getter]

functions exported by library. The index is function ID.

addFunction
integer addFunction(Function func)

Adds a new function

vars
Variable[] vars [@property getter]

global variables exported by this library. index is ID

addVar
integer addVar(Variable var)

Adds a new variable.

structs
Struct[] structs [@property getter]

structs exported by library

addStruct
integer addStruct(Struct str)

Adds a new struct

enums
Enum[] enums [@property getter]

Enums exported by library

addEnum
integer addEnum(Enum enu)

Adds a new enum

hasStruct
bool hasStruct(string name, Struct str)
bool hasStruct(string name)
hasEnum
bool hasEnum(string name, Enum enu)
bool hasEnum(string name)
hasVar
integer hasVar(string name, DataType type)
hasVar
bool hasVar(string name)
hasFunction
integer hasFunction(string name, DataType[] argsType, DataType returnType)
integer hasFunction(string name, DataType[] argsType)
hasFunction
bool hasFunction(string name)
functionCallArgumentsPushOrder
uinteger[] functionCallArgumentsPushOrder(uinteger functionId)

For use with generateFunctionCallCode. Use this to change what order arguments are pushed to stack before the bytecode for functionCall is generated

generateFunctionCallCode
bool generateFunctionCallCode(QScriptBytecode bytecode, uinteger functionId, CodeGenFlags flags)

Generates bytecode for a function call, or return false

generateVariableCode
bool generateVariableCode(QScriptBytecode bytecode, uinteger variableId, CodeGenFlags flags)

Generates bytecode that will push value of a variable to stack, or return false

execute
NaData execute(uinteger functionId, NaData[] args)

Executes a library function

getVar
NaData getVar(uinteger varId)
getVarRef
NaData getVarRef(uinteger varId)

Sets value of a variable

toString
string toString()

Writes this library to a single printable string

fromString
string fromString(string libraryString)

Reads this library from a string (reverse of toString)

Meta