VisionaireObject Command: getId

From The Official Visionaire Studio: Adventure Game Engine Wiki

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")