GetLinks (CMS)

From The Official Visionaire Studio: Adventure Game Engine Wiki

Function History

Available since v3.0


Allows you to access, read & manipulate grouped data tables for objects, items, characters, conditions, & values etc...


Additional Info

The data has to be iterated before you can access it.


Syntax:

getLinks(t_links)


Example 1: using getLinks as initial function.

local lang = game:getLinks(VGameLanguages) -- store all available game languages

-- * iterate the data * --
for i = 1, table.maxn(lang) do -- for i = 1 to amount of entries in lang table do...
 print(lang[i]:getId().id .. ": " .. lang[i]:getName()) -- prints "language id: language name"
end

Example 2: using getLinks after other functions

local obj = game:getLink(VGameCurrentObject)

if not obj:isEmpty() then -- if obj is not empty do...
 if obj:getId().tableId == eCharacters then obj = obj:getLinks(VCharacterActions) else obj = obj:getLinks(VObjectActions) end -- check if obj is a character or an object
 -- * iterate the data * --
 for i = 1, table.maxn(obj) do -- for i = 1 to amount of entries in obj table do...
  print(i .. ": " .. obj[i]:getName()) -- prints "incremental value: action name"
 end
end


Arguments

t_links: text
The name of the grouped data structure object table.


Flags

none


Return

object
Returns the data from the linked objects table; or returns empty.