ensure optional returns are un-engaged upon none/nil -- nil does NOT count

This commit is contained in:
ThePhD 2018-05-20 15:25:50 -04:00
parent 4f366a17a9
commit 03f17d41eb
3 changed files with 4 additions and 12 deletions

View File

@ -20,8 +20,8 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script.
// Generated 2018-05-14 17:21:18.007667 UTC
// This header was generated with sol v2.20.0 (revision f8ee7ab)
// Generated 2018-05-20 19:25:19.981188 UTC
// This header was generated with sol v2.20.1 (revision 4f366a1)
// https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_HPP
@ -9728,11 +9728,7 @@ namespace stack {
static optional<T> get(lua_State* L, int index, Handler&& handler, record& tracking) {
// actually check if it's none here, otherwise
// we'll have a none object inside an optional!
#if defined(SOL_SAFE_REFERENCES) && SOL_SAFE_REFERENCES
bool success = stack::check<T>(L, index, no_panic);
#else
bool success = !lua_isnone(L, index);
#endif
if (!success) {
// expected type, actual type
tracking.use(static_cast<int>(success));

View File

@ -20,8 +20,8 @@
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// This file was generated with a script.
// Generated 2018-05-14 17:21:18.351259 UTC
// This header was generated with sol v2.20.0 (revision f8ee7ab)
// Generated 2018-05-20 19:25:20.251908 UTC
// This header was generated with sol v2.20.1 (revision 4f366a1)
// https://github.com/ThePhD/sol2
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP

View File

@ -53,11 +53,7 @@ namespace stack {
static optional<T> get(lua_State* L, int index, Handler&& handler, record& tracking) {
// actually check if it's none here, otherwise
// we'll have a none object inside an optional!
#if defined(SOL_SAFE_REFERENCES) && SOL_SAFE_REFERENCES
bool success = stack::check<T>(L, index, no_panic);
#else
bool success = !lua_isnone(L, index);
#endif
if (!success) {
// expected type, actual type
tracking.use(static_cast<int>(success));