Global Command: getObject

From The Official Visionaire Studio: Adventure Game Engine Wiki
Revision as of 22:29, 3 May 2023 by EK (talk | contribs) (Created page with "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 Visi...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.

local doorCond = getObject("Scenes[office].SceneConditions[door_open?]")

-- Note that the same can be achieved easier with the "shorthand" notation
local doorCond = Scenes["office"].Conditions["door_open?"]