VisionaireObject Command: getParent

From The Official Visionaire Studio: Adventure Game Engine Wiki

Returns the parent object of the VisionaireObject.


Syntax

getParent()


Parameters

none


Return values

Type Description
TVisObj The parent object of the VisionaireObject.


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