Script

SDK GameObject script API documentation

Namespace: dmGameObject
Include: #include <dmsdk/gameobject/script.h>
FUNCTIONS
template <T> bool PostDDF(T* message, dmMessage::Message* sender, dmMessage::Message* receiver, int function_ref, bool unref_function_after_call) Sends a script message
Result PostScriptUnrefMessage(dmMessage::Message* sender, dmMessage::Message* receiver, int reference) Sends an unref script message
HPropertyContainer PropertyContainerCreateFromLua(lua_State* L, int index) Creates a property container from a lua table

Functions

PostDDF

bool PostDDF(T* message, dmMessage::Message* sender, dmMessage::Message* receiver, int function_ref, bool unref_function_after_call)

Sends a script message. Wraps the message in a dmGameSystemDDF::ScriptMessage struct.

PARAMETERS

T* message The ddf message to send
dmMessage::Message* sender The sender
dmMessage::Message* receiver The receiver
int function_ref The function ref. 0 wil cause the "on_message" to be called
bool unref_function_after_call call dmScript::UnrefInInstance on the function_ref after the dmScript::PCall is made

RETURNS

bool true if successful

PostScriptUnrefMessage

Result PostScriptUnrefMessage(dmMessage::Message* sender, dmMessage::Message* receiver, int reference)

Sends a script message to unreference a script object

PARAMETERS

dmMessage::Message* sender The sender
dmMessage::Message* receiver The receiver
int reference The reference to remove

RETURNS

Result RESULT_OK if successful

PropertyContainerCreateFromLua

HPropertyContainer PropertyContainerCreateFromLua(lua_State* L, int index)

Creates a property container from a lua table

PARAMETERS

lua_State* L The lua state
int index The lua stack index of the lua table

RETURNS

HPropertyContainer The property container