C++ API
The C++ API used to interface with the game engine in various ways.
All functions of the C++ API are global.
LSO
- class LSO
Not technically part of the API but detailed here for a lack of better place to put it.
LSOs are the engine’s method of interfacing with Lua scripted entities. Every script class is linked to an LSO.
If a function takes/returns or LSO, this can be thought of as that function just taking/returning a script object.
CreateObject
- CreateObject(BaseClass, ClassName)
Creates and returns an
LSO. For use in entity constructors. Not to be confused withSpawnScript()- Parameters
BaseClass (
string) – Specifies the class to inherit from. All classes should ultimately have ScriptBase at the top of their inheritance chain. Case-sensitive.ClassName (
string) – This should match the name of the class exactly. This parameter is used to do internal setup for when another class wishes to inherit from this one.
- Returns
The resulting LSO
- Return type
SpawnScript
- SpawnScript(ClassName, Name, EditVars, has-entity, bDeleteOnLevelUnload)
Spawns a script class.
- Parameters
ClassName (
string) – Specifies the class to createName (
string) – Specifies what the created entity should be calledEditVars (
string) – Specifies the editvars of the entityhas-entity (
bool) – Specifies if a corresponding entity is created. It’s currently unclear what this entails. Causes an error if used with bDeleteOnLevelUnload=0.bDeleteOnLevelUnload (
bool) – Controls whether the created entity will be removed when the level unloads. Causes an error if used with bDeleteOnLevelUnload=1.
GamePrint
- GamePrint(message)
Prints a message to the debug console
- Parameters
message (
string) – The message to print