Difference between revisions of "VisionaireObject Command: getLink"
From The Official Visionaire Studio: Adventure Game Engine Wiki
m (EK moved page GetLink (CMS) to VisionaireObject Command: getLink) |
|||
(7 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | + | Returns the VisionaireObject which is linked in a VisionaireObject field. | |
− | |||
− | |||
− | |||
− | |||
− | + | == Syntax == | |
− | + | <syntaxhighlight lang="lua"> | |
− | + | getLink(field) | |
− | |||
− | Syntax | ||
− | <syntaxhighlight> | ||
− | getLink( | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | == Parameters == | |
− | + | {| class="ts" | |
− | + | |- | |
+ | ! style="width:15%" | Parameter | ||
+ | ! style="width:15%" | 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 == | |
− | + | {| class="ts" | |
+ | |- | ||
+ | ! style="width:15%" | 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. |
− | + | <syntaxhighlight lang="lua"> | |
+ | -- 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 | ||
+ | </syntaxhighlight> | ||
+ | {{toc}} |
Latest revision as of 23:45, 11 August 2023
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