Difference between revisions of "VisionaireObject Command: getLink"
From The Official Visionaire Studio: Adventure Game Engine Wiki
m (Text replacement - "{{toc}}" to "") |
|||
| Line 1: | Line 1: | ||
| − | + | Returns the VisionaireObject which is linked in a VisionaireObject field. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | Syntax | + | == Syntax == |
| − | <syntaxhighlight> | + | <syntaxhighlight lang="lua"> |
| − | getLink( | + | getLink(field) |
</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" | |
| − | The | + | |- |
| + | ! 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}} | |
| − | |||
Revision as of 23:44, 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