Difference between revisions of "VisionaireObject Command: getPath"

From The Official Visionaire Studio: Adventure Game Engine Wiki
(Created page with "Returns the path to a media file, linked in a VisionaireObject field. == Syntax == <syntaxhighlight lang="lua"> getPath(field) </syntaxhighlight> == Parameters == {| clas...")
 
 
Line 31: Line 31:
 
|-
 
|-
 
| string
 
| string
| The file path stored in the field.
+
| The file path stored in the field. The path will be returned in unix format ("/" for directories) and relative to the .ved file.
 
|}
 
|}
  

Latest revision as of 15:41, 31 August 2023

Returns the path to a media file, linked in a VisionaireObject field.


Syntax

getPath(field)


Parameters

Parameter Type Description
field integer The field which specifies a path. The field type must be "t_path".

Specify the field constant name (V + object table name in singular + field name) or the field id, see the example.


Return values

Type Description
string The file path stored in the field. The path will be returned in unix format ("/" for directories) and relative to the .ved file.


Examples

Example 1: Get the file path to a scene's background music.

-- Specify the field constant name or the field id
local bg_file = getObject("Scenes[kitchen]"):getPath(VSceneBackgroundMusic)
local bg_file = getObject("Scenes[kitchen]"):getPath(132)

-- The shorthand notation offers a more convenient way to achieve the same
local bg_file = Scenes["kitchen"].BackgroundMusic