mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
update single, change optional semantics with nullable references
This commit is contained in:
parent
2e1fcd32dd
commit
ab5b417fb0
|
@ -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-03-03 18:42:29.548819 UTC
|
||||
// This header was generated with sol v.2.19.4 (revision cd13f2d)
|
||||
// Generated 2018-03-03 20:38:52.222840 UTC
|
||||
// This header was generated with sol v2.19.5 (revision 2e1fcd3)
|
||||
// https://github.com/ThePhD/sol2
|
||||
|
||||
#ifndef SOL_SINGLE_INCLUDE_HPP
|
||||
|
@ -9468,6 +9468,23 @@ namespace stack {
|
|||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct check_getter<T, std::enable_if_t<is_lua_reference<T>::value>> {
|
||||
template <typename Handler>
|
||||
static optional<T> get(lua_State* L, int index, Handler&& handler, record& tracking) {
|
||||
tracking.use(1);
|
||||
// actually check if it's none here, otherwise
|
||||
// we'll have a nil object inside an optional!
|
||||
bool success = !lua_isnoneornil(L, index);
|
||||
if (!success) {
|
||||
// expected type, actual type
|
||||
handler(L, index, type::poly, type_of(L, index), "");
|
||||
return nullopt;
|
||||
}
|
||||
return stack_detail::unchecked_get<T>(L, index, tracking);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct check_getter<optional<T>> {
|
||||
template <typename Handler>
|
||||
|
|
|
@ -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-03-03 18:42:29.769950 UTC
|
||||
// This header was generated with sol v.2.19.4 (revision cd13f2d)
|
||||
// Generated 2018-03-03 20:38:52.449565 UTC
|
||||
// This header was generated with sol v2.19.5 (revision 2e1fcd3)
|
||||
// https://github.com/ThePhD/sol2
|
||||
|
||||
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP
|
||||
|
|
|
@ -47,6 +47,23 @@ namespace stack {
|
|||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct check_getter<T, std::enable_if_t<is_lua_reference<T>::value>> {
|
||||
template <typename Handler>
|
||||
static optional<T> get(lua_State* L, int index, Handler&& handler, record& tracking) {
|
||||
tracking.use(1);
|
||||
// actually check if it's none here, otherwise
|
||||
// we'll have a nil object inside an optional!
|
||||
bool success = !lua_isnoneornil(L, index);
|
||||
if (!success) {
|
||||
// expected type, actual type
|
||||
handler(L, index, type::poly, type_of(L, index), "");
|
||||
return nullopt;
|
||||
}
|
||||
return stack_detail::unchecked_get<T>(L, index, tracking);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct check_getter<optional<T>> {
|
||||
template <typename Handler>
|
||||
|
|
Loading…
Reference in New Issue
Block a user