VisionaireObject Command: getId

From The Official Visionaire Studio: Adventure Game Engine Wiki
Revision as of 16:39, 31 August 2023 by EK (talk | contribs) (Created page with "Returns a table containing the internal id of the VisionaireObject and the id of the table it belongs to. == Syntax == <syntaxhighlight lang="lua"> getId() </syntaxhighlight...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Returns a table containing the internal id of the VisionaireObject and the id of the table it belongs to.


Syntax

getId()


Parameters

none


Return values

Type/Structure Description
table id (int) Internal id of the VisionaireObject
tableId (int) Id of the table the VisionaireObject belongs to


Examples

Example 1: Check if an animation belongs to a character or not.

function checkAnimOwner(anim)
  anim = getObject("Animations[" .. anim .. "]")

  if anim:getParent():getId().tableId == eOutfits then
    print("The animation with id=" .. anim:getId().id .. " is a character animation.")
  else
    print("The animation with id=" .. anim:getId().id .. " is not a character animation.")
  end
end

checkAnimOwner("welding_anim")

-- The shorthand notation offers a more convenient way to achieve the same
function checkAnimOwner(anim)
  anim = Animations[anim]

  if anim.parent.tableId == eOutfits then
    print("The animation with id=" .. anim.id .. " is a character animation")
  else
    print("The animation with id=" .. anim.id .. " is not a character animation")
  end
end

checkAnimOwner("welding_anim")