QScriptModule CreateModule(const char* name, QModuleDefFunc* funcs)
Takes a name, and a QModuleDefFunc list, returns a QScriptModule
void LoadMods(const char* filename)
Will load a file inside the root of every mod.
void LoadModsInDirectory(const char* folder, const char* filename)
Acts like LoadMods, but loads a file inside a subdirectory. (mods/*/folder/filename.*)
QScriptClassCreator StartClass(const char* name, QScriptClass parent)
Returns a QScriptClassCreator
void AddMethod(QScriptClassCreator creator, const char* name, QType* params, QCFunc func, bool is_private = false)
Adds a method to the class creator. Takes a name, QType list which will be the parameters, QCFunc which will be the callback, and an optional is_private bool.
void AddScriptingMethod(QScriptClassCreator creator, const char* name, QScriptCallback callback, bool is_private)
Adds a scripting language method for the class creator. Takes a name, QScriptCallback which will be called when the method is called, and an optional is_private bool.
void AddVariable(QScriptClassCreator creator, const char* name, QType type, QValue defaultval, bool is_private)
Adds a variable with a default value to the class creator. Takes a name, QType, QValue, and an optional is_private bool.
Do not use this for adding strings. Use the next method instead.
void AddString(QScriptClassCreator creator, const char* name, const char* defaultval, bool is_private)
Adds a string variable to the class creator. Takes a name, a default value and an optional is_private bool.
QScriptClass FinishClass(QScriptClassCreator creator)
Finishes the class creator and returns a QScriptClass. Will delete the creator.
QScriptObject CreateObject(QScriptClass cls)
Returns a new QScriptObject. Takes a class from which to create the object.
void InitializeObject(QScriptObject object)
Initializes a QScriptObject. Call every time after you create one! Takes a QScriptObject.
int GetObjectValueIndex(QScriptObject object, const char* name)
Gets a index of a variable from the object. Takes a QScriptObject and a name of the variable.
void SetObjectValue(QScriptObject object, int index, QValue val)
Sets a value inside an object. Takes the object, the index of the value, and a QValue. Do not use this function for setting strings.
void SetObjectString(QScriptObject object, int index, const char* str)
Sets a string inside an object. Takes the object, the index of the value and a string.
QValue GetObjectValue(QScriptObject object, int index)
Gets a value from an object. Returns a QValue and takes the object and the index of the value.
QType GetObjectValueType(QScriptObject object, int index)
Gets the type of a value in the object. Takes the object and the index of the value. Returns a QType.
int GetObjectMethodIndex(QScriptObject object, const char* name)
Gets the index of a method in the object. Takes the object and the name of the method.
QScriptFunction GetObjectMethod(QScriptObject object, int index)
Gets the method of an object. Takes the object and the index of the method. Returns a QScriptFunction.
QReturn CallObjectMethod(QScriptObject object, int index, QScriptArgs arguments);
Calls a method from the object. Takes the object, index of the method and QScriptArgs.
QValue GetArgValue(QScriptArgs args, int index)
Gets a value from some arguments. Takes a QScriptArgs and the argument index.
QType GetArgType(QScriptArgs args, int index)
Gets the type of the argument from a QScriptArgs. Takes a QScriptArgs and the argument index.
void CallFunction(QScriptFunction function, const char* fmt, ...)
Calls a QScriptFunction, takes a string which represents the types of arguments and a vararg which are the arguments themselves. The arguments are normal C++ types.
Here is a table of chars to QType
| char | QType |
|---|---|
s |
QType_String |
i |
QType_Int |
f |
QType_Float |
o |
QType_Object |
b |
QType_Bool |
p |
QType_Function |