VisionaireObject Command: getLink

From The Official Visionaire Studio: Adventure Game Engine Wiki
Revision as of 23:45, 11 August 2023 by EK (talk | contribs) (EK moved page GetLink (CMS) to VisionaireObject Command: getLink)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Returns the VisionaireObject which is linked in a VisionaireObject field.


Syntax

getLink(field)


Parameters

Parameter Type Description
field integer The field which specifies a VisionaireObject link. The field type must be "t_link".

Specify the field constant name (V + object table name in singular + field name) or the field id, see the example.


Return values

Type Description
TVisObj The VisionaireObject linked in the field or an empty object if no object is linked


Examples

Example 1: Get the currently playable character.

-- Specify the field constant name or the field id
local curr_char = game:getLink(VGameCurrentCharacter)
local curr_char = game:getLink(468)

-- The shorthand notation offers a more convenient way to achieve the same
local curr_char = game.CurrentCharacter