Global Command: getObject
From The Official Visionaire Studio: Adventure Game Engine Wiki
Get a Visionaire object.
Note that in most cases it is no longer necessary to make use of this function, because Visionaire objects can now be accessed directly (since Visionaire Studio version 5.0).
Syntax
getObject(path_or_tuple [, logWarning])
Parameters
Parameter | Type | Description |
---|---|---|
path_or_tuple | string | Path to a Visionaire Object. The path has to start with a table name, followed by the object name in square brackets ([...]). The "game" table does not have object names. 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 square brackets ([...]). Alternatively, you can pass in a tuple with the table id and the object id, e. g. "(0,3)". |
logWarning | boolean | If true a warning will be printed to the log file if the object could not be found. The default value is true. |
Return values
Type | Description |
---|---|
TVisObj | The Visionaire object or an empty object if no object was found. |
Examples
Example 1: Access a condition just by its name (name must be unique throughout the project).
local doorCond = getObject("Conditions[door_open?]")
-- Note that the same can be achieved easier with the "shorthand" notation
local doorCond = Conditions["door_open?"]
Example 2: Access a condition of a specific object by passing the full path.
local doorCond = getObject("Scenes[office].SceneObjects[door].ObjectConditions[door_open?]")
-- Note that the same can be achieved easier with the "shorthand" notation
local doorCond = Scenes["office"].Objects["door"].Conditions["door_open?"]
Example 3: Access a character by passing a tuple: get object with id=3 from table with id=0 (characters table).
local char = getObject("(0,3)")