Difference between revisions of "VisionaireObject Command: getBool"
From The Official Visionaire Studio: Adventure Game Engine Wiki
m (Text replacement - "{{toc}}" to "") |
|||
| (4 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | + | Returns the boolean value of a VisionaireObject field. | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | + | == Syntax == | |
| − | + | <syntaxhighlight lang="lua"> | |
| − | + | getBool(field) | |
| − | Syntax | ||
| − | <syntaxhighlight> | ||
| − | getBool( | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| − | + | == Parameters == | |
| − | |||
| − | |||
| − | |||
| + | {| class="ts" | ||
| + | |- | ||
| + | ! style="width:15%" | Parameter | ||
| + | ! style="width:15%" | Type | ||
| + | ! Description | ||
| + | |- | ||
| + | | field | ||
| + | | integer | ||
| + | | The field which specifies a boolean value. The field type must be "t_bool". | ||
| + | ''Specify the field constant name (V + object table name in singular + field name) or the field id, see the example.'' | ||
| + | |} | ||
| − | |||
| − | + | == Return values == | |
| + | {| class="ts" | ||
| + | |- | ||
| + | ! style="width:15%" | Type | ||
| + | ! Description | ||
| + | |- | ||
| + | | boolean | ||
| + | | The boolean value of the field. | ||
| + | |} | ||
| − | |||
| − | + | == Examples == | |
| + | '''Example 1:''' Get the boolean value of a condition. | ||
| + | <syntaxhighlight lang="lua"> | ||
| + | -- Specify the field constant name or the field id | ||
| + | local door_state = getObject("Conditions[door_closed]"):getBool(VConditionValue) | ||
| + | local door_state = getObject("Conditions[door_closed]"):getBool(194) | ||
| − | + | -- The shorthand notation offers a more convenient way to achieve the same | |
| − | + | local door_state = Conditions["door_closed"].Value | |
| − | + | </syntaxhighlight> | |
| − | + | {{toc}} | |
Latest revision as of 20:13, 11 August 2023
Returns the boolean value of a VisionaireObject field.
Syntax
getBool(field)
Parameters
| Parameter | Type | Description |
|---|---|---|
| field | integer | The field which specifies a boolean value. The field type must be "t_bool".
Specify the field constant name (V + object table name in singular + field name) or the field id, see the example. |
Return values
| Type | Description |
|---|---|
| boolean | The boolean value of the field. |
Examples
Example 1: Get the boolean value of a condition.
-- Specify the field constant name or the field id
local door_state = getObject("Conditions[door_closed]"):getBool(VConditionValue)
local door_state = getObject("Conditions[door_closed]"):getBool(194)
-- The shorthand notation offers a more convenient way to achieve the same
local door_state = Conditions["door_closed"].Value