Difference between revisions of "VisionaireObject Command: getFloat"
From The Official Visionaire Studio: Adventure Game Engine Wiki
(Created page with "Returns the decimal value of a VisionaireObject field. == Syntax == <syntaxhighlight lang="lua"> getFloat(field) </syntaxhighlight> == Parameters == {| class="ts" |- ! st...") |
|||
Line 19: | Line 19: | ||
| int | | int | ||
| The field which specifies a decimal value. The field type must be "t_float". | | The field which specifies a decimal value. The field type must be "t_float". | ||
− | ''Specify | + | ''Specify the field constant name (V + object table name in singular + field name) or the field id, see the example.'' |
|} | |} | ||
Line 39: | Line 39: | ||
'''Example 1:''' Get the current size of a character. | '''Example 1:''' Get the current size of a character. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
− | -- Specify the field | + | -- Specify the field constant name or the field id |
local char_size = getObject("Characters[hero]"):getFloat(VCharacterSize) | local char_size = getObject("Characters[hero]"):getFloat(VCharacterSize) | ||
local char_size = getObject("Characters[hero]"):getFloat(749) | local char_size = getObject("Characters[hero]"):getFloat(749) |
Revision as of 20:09, 11 August 2023
Returns the decimal value of a VisionaireObject field.
Syntax
getFloat(field)
Parameters
Parameter | Type | Description |
---|---|---|
field | int | The field which specifies a decimal value. The field type must be "t_float".
Specify the field constant name (V + object table name in singular + field name) or the field id, see the example. |
Return values
Type | Description |
---|---|
decimal | The decimal value of the field. |
Examples
Example 1: Get the current size of a character.
-- Specify the field constant name or the field id
local char_size = getObject("Characters[hero]"):getFloat(VCharacterSize)
local char_size = getObject("Characters[hero]"):getFloat(749)
-- The shorthand notation offers a more convenient way to achieve the same
local char_size = Characters["hero"].Size