mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Merge pull request #322 from mrgeorg/patch-1
Variable.rst: correct typos
This commit is contained in:
commit
5b12924d9e
|
@ -60,7 +60,7 @@ You can interact with the variables like this:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
From this example, you can see that there's many ways to pull out the varaibles you want. You can get For example, to determine if a nested variable exists or not, you can use ``auto`` to capture the value of a ``table[key]`` lookup, and then use the ``.valid()`` method:
|
From this example, you can see that there's many ways to pull out the varaibles you want. For example, to determine if a nested variable exists or not, you can use ``auto`` to capture the value of a ``table[key]`` lookup, and then use the ``.valid()`` method:
|
||||||
|
|
||||||
.. code-block:: cpp
|
.. code-block:: cpp
|
||||||
:caption: safe lookup
|
:caption: safe lookup
|
||||||
|
@ -83,7 +83,7 @@ This comes in handy when you want to check if a nested variable exists. You can
|
||||||
// Branch not taken: value is not an integer
|
// Branch not taken: value is not an integer
|
||||||
}
|
}
|
||||||
|
|
||||||
sol::optoinal<bool> is_a_boolean = lua["config"]["fullscreen"];
|
sol::optional<bool> is_a_boolean = lua["config"]["fullscreen"];
|
||||||
if (is_a_boolean) {
|
if (is_a_boolean) {
|
||||||
// Branch taken: the value is a boolean
|
// Branch taken: the value is a boolean
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user