Difference between revisions of "VisionaireObject Command: getLinks"

From The Official Visionaire Studio: Adventure Game Engine Wiki
 
Line 30: Line 30:
 
! Description
 
! Description
 
|-
 
|-
| table of t_links
+
| table
| The table of VisionaireObjects linked in the field
+
| The table of VisionaireObjects (t_link values) linked in the field
 
|}
 
|}
  

Latest revision as of 17:32, 25 August 2023

Returns a table containing multiple VisionaireObjects.


Syntax

getLinks(field)


Parameters

Parameter Type Description
field integer The field which specifies a list of VisionaireObject links. The field type must be "t_links".

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


Return values

Type Description
table The table of VisionaireObjects (t_link values) linked in the field


Examples

Example 1: Print the names of all game languages to the log.

-- Specify the field constant name or the field id
local lang = game:getLinks(VGameLanguages)
local lang = game:getLinks(259)

-- Iterate the table and print the language ids and names
for i = 1, #lang do
  print(lang[i]:getId().id .. ": " .. lang[i]:getName())
end

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

for i = 1, #lang do
  print(lang[i].id .. ": " .. lang[i].name)
end