Difference between revisions of "GetObject"

From The Official Visionaire Studio: Adventure Game Engine Wiki
(Created page with "==getObject== <div class="command-min-version-info">Available since: <span class="command-min-version">v3.0</span></div> Lua Syntax: <pre class="command-syntax">getObject(pa...")
 
(One intermediate revision by the same user not shown)
Line 15: Line 15:
 
:The found visionaire object or an empty object if no object was found.
 
:The found visionaire object or an empty object if no object was found.
 
===Examples===
 
===Examples===
None.
+
Example 1: Access object by scanning whole object table (object name must be unique for whole table)
 +
<syntaxhighlight>
 +
getObject("Conditions[door_open?]") -- get condition with name 'door open?'
 +
</syntaxhighlight>
 +
Example 2: Specific object access
 +
<syntaxhighlight>
 +
getObject("Scenes[office].SceneConditions[door_open?]") -- get condition 'door open?' linked to scene 'office'
 +
</syntaxhighlight>

Revision as of 22:27, 30 September 2014

getObject

Available since: v3.0

Lua Syntax:

getObject(path_or_tuple [, logWarning])

Arguments

path_or_tuple

"string" - Path to a Visionaire Object. The path has to start with a table name, then follows the object name in brackets ('[',']') - only the game table does not have an object name. Optionally a field name (field type must either be t_link or t_links) can follow after a dot '.'. For t_links fields you must specify an object name in brackets ('[',']'). For t_link fields there are no brackets. Alternatively you can also pass in a tuple with the table id and the object id, e.g. "(0,3)".

logWarning

true|false - If true (default) a warning will be printed to the log file if the object could not be found.

Flags

Return Values

visionaireObject
The found visionaire object or an empty object if no object was found.

Examples

Example 1: Access object by scanning whole object table (object name must be unique for whole table)

getObject("Conditions[door_open?]") -- get condition with name 'door open?'

Example 2: Specific object access

getObject("Scenes[office].SceneConditions[door_open?]") -- get condition 'door open?' linked to scene 'office'