Difference between revisions of "VisionaireObject Command: getLinks"

From The Official Visionaire Studio: Adventure Game Engine Wiki
(No difference)

Revision as of 17:17, 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 of t_links The table of VisionaireObjects 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