mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
update single
prep for next version
This commit is contained in:
parent
399300fa6e
commit
a2034bcc1c
|
@ -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 2017-12-07 14:35:57.076918 UTC
|
||||
// This header was generated with sol v2.18.7 (revision a99ea97)
|
||||
// Generated 2017-12-08 03:12:27.695525 UTC
|
||||
// This header was generated with sol v2.19.0 (revision 399300f)
|
||||
// https://github.com/ThePhD/sol2
|
||||
|
||||
#ifndef SOL_SINGLE_INCLUDE_HPP
|
||||
|
@ -92,12 +92,8 @@
|
|||
#ifdef _MSC_VER
|
||||
#if defined(_DEBUG) && !defined(NDEBUG)
|
||||
|
||||
#if !defined(SOL_SAFE_REFERENCES)
|
||||
#define SOL_SAFE_REFERENCES 1
|
||||
#endif
|
||||
|
||||
#if !defined(SOL_SAFE_USERTYPE)
|
||||
#define SOL_SAFE_USERTYPE 1
|
||||
#ifndef SOL_IN_DEBUG_DETECTED
|
||||
#define SOL_IN_DEBUG_DETECTED 1
|
||||
#endif
|
||||
|
||||
#endif // VC++ Debug macros
|
||||
|
@ -117,13 +113,9 @@
|
|||
|
||||
#if !defined(NDEBUG) && !defined(__OPTIMIZE__)
|
||||
|
||||
#if !defined(SOL_SAFE_REFERENCES)
|
||||
#define SOL_SAFE_REFERENCES 1
|
||||
#endif
|
||||
|
||||
#if !defined(SOL_SAFE_USERTYPE)
|
||||
#define SOL_SAFE_USERTYPE 1
|
||||
#endif
|
||||
#ifndef SOL_IN_DEBUG_DETECTED
|
||||
#define SOL_IN_DEBUG_DETECTED 1
|
||||
#endif SOL_IN_DEBUG_DETECTED
|
||||
|
||||
#endif // Not Debug && g++ optimizer flag
|
||||
|
||||
|
@ -155,6 +147,10 @@
|
|||
#define SOL_SAFE_REFERENCES 1
|
||||
#endif
|
||||
|
||||
#if !defined(SOL_SAFE_FUNCTION)
|
||||
#define SOL_SAFE_FUNCTION 1
|
||||
#endif
|
||||
|
||||
#if !defined(SOL_SAFE_FUNCTION_CALLS)
|
||||
#define SOL_SAFE_FUNCTION_CALLS 1
|
||||
#endif
|
||||
|
@ -163,14 +159,45 @@
|
|||
#define SOL_SAFE_PROXIES 1
|
||||
#endif
|
||||
|
||||
#if !defined(SOL_SAFE_NUMERICS)
|
||||
#define SOL_SAFE_NUMERICS 1
|
||||
#endif
|
||||
|
||||
#endif // Turn on Safety for all if top-level macro is defined
|
||||
|
||||
#ifdef SOL_IN_DEBUG_DETECTED
|
||||
|
||||
#if !defined(SOL_SAFE_REFERENCES)
|
||||
#define SOL_SAFE_REFERENCES 1
|
||||
#endif
|
||||
|
||||
#if !defined(SOL_SAFE_USERTYPE)
|
||||
#define SOL_SAFE_USERTYPE 1
|
||||
#endif
|
||||
|
||||
#if !defined(SOL_SAFE_FUNCTION_CALLS)
|
||||
#define SOL_SAFE_FUNCTION_CALLS 1
|
||||
#endif
|
||||
|
||||
#endif // Turn on all debug safety features for VC++ / g++ / clang++ and similar
|
||||
|
||||
#if defined(__MAC_OS_X_VERSION_MAX_ALLOWED) || defined(__OBJC__) || defined(nil)
|
||||
#ifndef SOL_NO_NIL
|
||||
#if !defined(SOL_NO_NIL)
|
||||
#define SOL_NO_NIL 1
|
||||
#endif
|
||||
#endif // avoiding nil defines / keywords
|
||||
|
||||
namespace sol {
|
||||
namespace detail {
|
||||
const bool default_safe_function_calls =
|
||||
#ifdef SOL_SAFE_FUNCTION_CALLS
|
||||
true;
|
||||
#else
|
||||
false;
|
||||
#endif
|
||||
}
|
||||
} // namespace sol::detail
|
||||
|
||||
// end of sol/feature_test.hpp
|
||||
|
||||
namespace sol {
|
||||
|
@ -7045,13 +7072,6 @@ namespace sol {
|
|||
template <typename T>
|
||||
using strip_extensible_t = typename strip_extensible<T>::type;
|
||||
|
||||
const bool default_check_arguments =
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
true;
|
||||
#else
|
||||
false;
|
||||
#endif
|
||||
|
||||
template <typename C>
|
||||
static int get_size_hint(const C& c) {
|
||||
return static_cast<int>(c.size());
|
||||
|
@ -7201,7 +7221,7 @@ namespace sol {
|
|||
|
||||
namespace stack_detail {
|
||||
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_GETTER
|
||||
template <typename T>
|
||||
inline auto tagged_get(types<T>, lua_State* L, int index, record& tracking) -> decltype(stack_detail::unchecked_get<T>(L, index, tracking)) {
|
||||
auto op = check_get<T>(L, index, type_panic_c_str, tracking);
|
||||
|
@ -8893,7 +8913,7 @@ namespace stack {
|
|||
int isnum = 0;
|
||||
const lua_Number value = lua_tonumberx(L, index, &isnum);
|
||||
if (isnum != 0) {
|
||||
#if defined(SOL_CHECK_ARGUMENTS) && !defined(SOL_NO_CHECK_NUMBER_PRECISION)
|
||||
#if defined(SOL_SAFE_NUMERICS) && !defined(SOL_NO_CHECK_NUMBER_PRECISION)
|
||||
const auto integer_value = llround(value);
|
||||
if (static_cast<lua_Number>(integer_value) == value) {
|
||||
tracking.use(1);
|
||||
|
@ -9179,7 +9199,7 @@ namespace stack {
|
|||
return 1;
|
||||
}
|
||||
#endif
|
||||
#if defined(SOL_CHECK_ARGUMENTS) && !defined(SOL_NO_CHECK_NUMBER_PRECISION)
|
||||
#if defined(SOL_SAFE_NUMERICS) && !defined(SOL_NO_CHECK_NUMBER_PRECISION)
|
||||
if (static_cast<T>(llround(static_cast<lua_Number>(value))) != value) {
|
||||
#ifdef SOL_NO_EXCEPTIONS
|
||||
// Is this really worth it?
|
||||
|
@ -10381,7 +10401,7 @@ namespace sol {
|
|||
}
|
||||
};
|
||||
|
||||
template <bool checkargs = default_check_arguments, std::size_t... I, typename R, typename... Args, typename Fx, typename... FxArgs, typename = std::enable_if_t<!std::is_void<R>::value>>
|
||||
template <bool checkargs = detail::default_safe_function_calls , std::size_t... I, typename R, typename... Args, typename Fx, typename... FxArgs, typename = std::enable_if_t<!std::is_void<R>::value >>
|
||||
inline decltype(auto) call(types<R>, types<Args...> ta, std::index_sequence<I...> tai, lua_State* L, int start, Fx&& fx, FxArgs&&... args) {
|
||||
#ifndef _MSC_VER
|
||||
static_assert(meta::all<meta::is_not_move_only<Args>...>::value, "One of the arguments being bound is a move-only type, and it is not being taken by reference: this will break your code. Please take a reference and std::move it manually if this was your intention.");
|
||||
|
@ -10392,7 +10412,7 @@ namespace sol {
|
|||
return evaluator{}.eval(ta, tai, L, start, tracking, std::forward<Fx>(fx), std::forward<FxArgs>(args)...);
|
||||
}
|
||||
|
||||
template <bool checkargs = default_check_arguments, std::size_t... I, typename... Args, typename Fx, typename... FxArgs>
|
||||
template <bool checkargs = detail::default_safe_function_calls, std::size_t... I, typename... Args, typename Fx, typename... FxArgs>
|
||||
inline void call(types<void>, types<Args...> ta, std::index_sequence<I...> tai, lua_State* L, int start, Fx&& fx, FxArgs&&... args) {
|
||||
#ifndef _MSC_VER
|
||||
static_assert(meta::all<meta::is_not_move_only<Args>...>::value, "One of the arguments being bound is a move-only type, and it is not being taken by reference: this will break your code. Please take a reference and std::move it manually if this was your intention.");
|
||||
|
@ -10410,41 +10430,41 @@ namespace sol {
|
|||
return luaL_ref(L, tableindex);
|
||||
}
|
||||
|
||||
template <bool check_args = stack_detail::default_check_arguments, typename R, typename... Args, typename Fx, typename... FxArgs, typename = std::enable_if_t<!std::is_void<R>::value>>
|
||||
template <bool check_args = detail::default_safe_function_calls, typename R, typename... Args, typename Fx, typename... FxArgs, typename = std::enable_if_t<!std::is_void<R>::value>>
|
||||
inline decltype(auto) call(types<R> tr, types<Args...> ta, lua_State* L, int start, Fx&& fx, FxArgs&&... args) {
|
||||
typedef std::make_index_sequence<sizeof...(Args)> args_indices;
|
||||
return stack_detail::call<check_args>(tr, ta, args_indices(), L, start, std::forward<Fx>(fx), std::forward<FxArgs>(args)...);
|
||||
}
|
||||
|
||||
template <bool check_args = stack_detail::default_check_arguments, typename R, typename... Args, typename Fx, typename... FxArgs, typename = std::enable_if_t<!std::is_void<R>::value>>
|
||||
template <bool check_args = detail::default_safe_function_calls, typename R, typename... Args, typename Fx, typename... FxArgs, typename = std::enable_if_t<!std::is_void<R>::value>>
|
||||
inline decltype(auto) call(types<R> tr, types<Args...> ta, lua_State* L, Fx&& fx, FxArgs&&... args) {
|
||||
return call<check_args>(tr, ta, L, 1, std::forward<Fx>(fx), std::forward<FxArgs>(args)...);
|
||||
}
|
||||
|
||||
template <bool check_args = stack_detail::default_check_arguments, typename... Args, typename Fx, typename... FxArgs>
|
||||
template <bool check_args = detail::default_safe_function_calls, typename... Args, typename Fx, typename... FxArgs>
|
||||
inline void call(types<void> tr, types<Args...> ta, lua_State* L, int start, Fx&& fx, FxArgs&&... args) {
|
||||
typedef std::make_index_sequence<sizeof...(Args)> args_indices;
|
||||
stack_detail::call<check_args>(tr, ta, args_indices(), L, start, std::forward<Fx>(fx), std::forward<FxArgs>(args)...);
|
||||
}
|
||||
|
||||
template <bool check_args = stack_detail::default_check_arguments, typename... Args, typename Fx, typename... FxArgs>
|
||||
template <bool check_args = detail::default_safe_function_calls, typename... Args, typename Fx, typename... FxArgs>
|
||||
inline void call(types<void> tr, types<Args...> ta, lua_State* L, Fx&& fx, FxArgs&&... args) {
|
||||
call<check_args>(tr, ta, L, 1, std::forward<Fx>(fx), std::forward<FxArgs>(args)...);
|
||||
}
|
||||
|
||||
template <bool check_args = stack_detail::default_check_arguments, typename R, typename... Args, typename Fx, typename... FxArgs, typename = std::enable_if_t<!std::is_void<R>::value>>
|
||||
template <bool check_args = detail::default_safe_function_calls, typename R, typename... Args, typename Fx, typename... FxArgs, typename = std::enable_if_t<!std::is_void<R>::value>>
|
||||
inline decltype(auto) call_from_top(types<R> tr, types<Args...> ta, lua_State* L, Fx&& fx, FxArgs&&... args) {
|
||||
typedef meta::count_for_pack<lua_size, Args...> expected_count;
|
||||
return call<check_args>(tr, ta, L, (std::max)(static_cast<int>(lua_gettop(L) - expected_count::value), static_cast<int>(0)), std::forward<Fx>(fx), std::forward<FxArgs>(args)...);
|
||||
}
|
||||
|
||||
template <bool check_args = stack_detail::default_check_arguments, typename... Args, typename Fx, typename... FxArgs>
|
||||
template <bool check_args = detail::default_safe_function_calls, typename... Args, typename Fx, typename... FxArgs>
|
||||
inline void call_from_top(types<void> tr, types<Args...> ta, lua_State* L, Fx&& fx, FxArgs&&... args) {
|
||||
typedef meta::count_for_pack<lua_size, Args...> expected_count;
|
||||
call<check_args>(tr, ta, L, (std::max)(static_cast<int>(lua_gettop(L) - expected_count::value), static_cast<int>(0)), std::forward<Fx>(fx), std::forward<FxArgs>(args)...);
|
||||
}
|
||||
|
||||
template <bool check_args = stack_detail::default_check_arguments, bool clean_stack = true, typename... Args, typename Fx, typename... FxArgs>
|
||||
template <bool check_args = detail::default_safe_function_calls, bool clean_stack = true, typename... Args, typename Fx, typename... FxArgs>
|
||||
inline int call_into_lua(types<void> tr, types<Args...> ta, lua_State* L, int start, Fx&& fx, FxArgs&&... fxargs) {
|
||||
call<check_args>(tr, ta, L, start, std::forward<Fx>(fx), std::forward<FxArgs>(fxargs)...);
|
||||
if (clean_stack) {
|
||||
|
@ -10453,7 +10473,7 @@ namespace sol {
|
|||
return 0;
|
||||
}
|
||||
|
||||
template <bool check_args = stack_detail::default_check_arguments, bool clean_stack = true, typename Ret0, typename... Ret, typename... Args, typename Fx, typename... FxArgs, typename = std::enable_if_t<meta::neg<std::is_void<Ret0>>::value>>
|
||||
template <bool check_args = detail::default_safe_function_calls, bool clean_stack = true, typename Ret0, typename... Ret, typename... Args, typename Fx, typename... FxArgs, typename = std::enable_if_t<meta::neg<std::is_void<Ret0>>::value>>
|
||||
inline int call_into_lua(types<Ret0, Ret...>, types<Args...> ta, lua_State* L, int start, Fx&& fx, FxArgs&&... fxargs) {
|
||||
decltype(auto) r = call<check_args>(types<meta::return_type_t<Ret0, Ret...>>(), ta, L, start, std::forward<Fx>(fx), std::forward<FxArgs>(fxargs)...);
|
||||
typedef meta::unqualified_t<decltype(r)> R;
|
||||
|
@ -10468,7 +10488,7 @@ namespace sol {
|
|||
return push_reference(L, std::forward<decltype(r)>(r));
|
||||
}
|
||||
|
||||
template <bool check_args = stack_detail::default_check_arguments, bool clean_stack = true, typename Fx, typename... FxArgs>
|
||||
template <bool check_args = detail::default_safe_function_calls, bool clean_stack = true, typename Fx, typename... FxArgs>
|
||||
inline int call_lua(lua_State* L, int start, Fx&& fx, FxArgs&&... fxargs) {
|
||||
typedef lua_bind_traits<meta::unqualified_t<Fx>> traits_type;
|
||||
typedef typename traits_type::args_list args_list;
|
||||
|
@ -10825,9 +10845,10 @@ namespace sol {
|
|||
|
||||
template <typename T>
|
||||
decltype(auto) tagged_get(types<optional<T>>, int index_offset) const {
|
||||
typedef decltype(stack::get<optional<T>>(L, index)) ret_t;
|
||||
int target = index + index_offset;
|
||||
if (!valid()) {
|
||||
return optional<T>(nullopt);
|
||||
return ret_t(nullopt);
|
||||
}
|
||||
return stack::get<optional<T>>(L, target);
|
||||
}
|
||||
|
@ -10835,7 +10856,7 @@ namespace sol {
|
|||
template <typename T>
|
||||
decltype(auto) tagged_get(types<T>, int index_offset) const {
|
||||
int target = index + index_offset;
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_PROXIES
|
||||
if (!valid()) {
|
||||
type t = type_of(L, target);
|
||||
type_panic_c_str(L, target, t, type::none, "bad get from protected_function_result (is not an error)");
|
||||
|
@ -10854,7 +10875,7 @@ namespace sol {
|
|||
|
||||
error tagged_get(types<error>, int index_offset) const {
|
||||
int target = index + index_offset;
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_PROXIES
|
||||
if (valid()) {
|
||||
type t = type_of(L, target);
|
||||
type_panic_c_str(L, target, t, type::none, "bad get from protected_function_result (is an error)");
|
||||
|
@ -11950,7 +11971,7 @@ namespace sol {
|
|||
}
|
||||
};
|
||||
|
||||
template <typename T, typename F, bool is_index, bool is_variable, bool checked = stack::stack_detail::default_check_arguments, int boost = 0, bool clean_stack = true, typename = void>
|
||||
template <typename T, typename F, bool is_index, bool is_variable, bool checked = detail::default_safe_function_calls, int boost = 0, bool clean_stack = true, typename = void>
|
||||
struct lua_call_wrapper : agnostic_lua_call_wrapper<F, is_index, is_variable, checked, boost, clean_stack> {};
|
||||
|
||||
template <typename T, typename F, bool is_index, bool is_variable, bool checked, int boost, bool clean_stack>
|
||||
|
@ -12312,12 +12333,12 @@ namespace sol {
|
|||
}
|
||||
};
|
||||
|
||||
template <typename T, bool is_index, bool is_variable, int boost = 0, bool checked = stack::stack_detail::default_check_arguments, bool clean_stack = true, typename Fx, typename... Args>
|
||||
template <typename T, bool is_index, bool is_variable, int boost = 0, bool checked = detail::default_safe_function_calls, bool clean_stack = true, typename Fx, typename... Args>
|
||||
inline int call_wrapped(lua_State* L, Fx&& fx, Args&&... args) {
|
||||
return lua_call_wrapper<T, meta::unqualified_t<Fx>, is_index, is_variable, checked, boost, clean_stack>{}.call(L, std::forward<Fx>(fx), std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
template <typename T, bool is_index, bool is_variable, typename F, int start = 1, bool checked = stack::stack_detail::default_check_arguments, bool clean_stack = true>
|
||||
template <typename T, bool is_index, bool is_variable, typename F, int start = 1, bool checked = detail::default_safe_function_calls, bool clean_stack = true>
|
||||
inline int call_user(lua_State* L) {
|
||||
auto& fx = stack::get<user<F>>(L, upvalue_index(start));
|
||||
return call_wrapped<T, is_index, is_variable, 0, checked, clean_stack>(L, fx);
|
||||
|
@ -13301,7 +13322,7 @@ namespace sol {
|
|||
template <typename T, typename... Lists>
|
||||
struct pusher<detail::tagged<T, constructor_list<Lists...>>> {
|
||||
static int push(lua_State* L, detail::tagged<T, constructor_list<Lists...>>) {
|
||||
lua_CFunction cf = call_detail::construct<T, stack_detail::default_check_arguments, true, Lists...>;
|
||||
lua_CFunction cf = call_detail::construct<T, detail::default_safe_function_calls, true, Lists...>;
|
||||
return stack::push(L, cf);
|
||||
}
|
||||
};
|
||||
|
@ -13403,7 +13424,7 @@ namespace sol {
|
|||
template <typename T, meta::enable<meta::neg<std::is_same<meta::unqualified_t<T>, basic_function>>, meta::neg<std::is_same<base_t, stack_reference>>, is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
||||
basic_function(T&& r) noexcept
|
||||
: base_t(std::forward<T>(r)) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
if (!is_function<meta::unqualified_t<T>>::value) {
|
||||
auto pp = stack::push_pop(*this);
|
||||
constructor_handler handler{};
|
||||
|
@ -13424,7 +13445,7 @@ namespace sol {
|
|||
template <typename T, meta::enable<is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
||||
basic_function(lua_State* L, T&& r)
|
||||
: base_t(L, std::forward<T>(r)) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
auto pp = stack::push_pop(*this);
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_function>(lua_state(), -1, handler);
|
||||
|
@ -13432,14 +13453,14 @@ namespace sol {
|
|||
}
|
||||
basic_function(lua_State* L, int index = -1)
|
||||
: base_t(L, index) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_function>(L, index, handler);
|
||||
#endif // Safety
|
||||
}
|
||||
basic_function(lua_State* L, ref_index index)
|
||||
: base_t(L, index) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
auto pp = stack::push_pop(*this);
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_function>(lua_state(), -1, handler);
|
||||
|
@ -13645,7 +13666,7 @@ namespace sol {
|
|||
template <typename T, meta::enable<meta::neg<std::is_same<meta::unqualified_t<T>, basic_protected_function>>, meta::neg<std::is_base_of<proxy_base_tag, meta::unqualified_t<T>>>, meta::neg<std::is_same<base_t, stack_reference>>, is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
||||
basic_protected_function(T&& r) noexcept
|
||||
: base_t(std::forward<T>(r)), error_handler(get_default_handler(r.lua_state())) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
if (!is_function<meta::unqualified_t<T>>::value) {
|
||||
auto pp = stack::push_pop(*this);
|
||||
constructor_handler handler{};
|
||||
|
@ -13702,7 +13723,7 @@ namespace sol {
|
|||
template <typename T, meta::enable<is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
||||
basic_protected_function(lua_State* L, T&& r, handler_t eh)
|
||||
: base_t(L, std::forward<T>(r)), error_handler(std::move(eh)) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
auto pp = stack::push_pop(*this);
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_protected_function>(lua_state(), -1, handler);
|
||||
|
@ -13714,7 +13735,7 @@ namespace sol {
|
|||
}
|
||||
basic_protected_function(lua_State* L, int index, handler_t eh)
|
||||
: base_t(L, index), error_handler(std::move(eh)) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_protected_function>(L, index, handler);
|
||||
#endif // Safety
|
||||
|
@ -13724,7 +13745,7 @@ namespace sol {
|
|||
}
|
||||
basic_protected_function(lua_State* L, absolute_index index, handler_t eh)
|
||||
: base_t(L, index), error_handler(std::move(eh)) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_protected_function>(L, index, handler);
|
||||
#endif // Safety
|
||||
|
@ -13734,7 +13755,7 @@ namespace sol {
|
|||
}
|
||||
basic_protected_function(lua_State* L, raw_index index, handler_t eh)
|
||||
: base_t(L, index), error_handler(std::move(eh)) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_protected_function>(L, index, handler);
|
||||
#endif // Safety
|
||||
|
@ -13744,7 +13765,7 @@ namespace sol {
|
|||
}
|
||||
basic_protected_function(lua_State* L, ref_index index, handler_t eh)
|
||||
: base_t(L, index), error_handler(std::move(eh)) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
auto pp = stack::push_pop(*this);
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_protected_function>(lua_state(), -1, handler);
|
||||
|
@ -14203,7 +14224,7 @@ namespace sol {
|
|||
template <typename T, meta::enable<meta::neg<std::is_same<meta::unqualified_t<T>, basic_userdata>>, meta::neg<std::is_same<base_t, stack_reference>>, is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
||||
basic_userdata(T&& r) noexcept
|
||||
: base_t(std::forward<T>(r)) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
if (!is_userdata<meta::unqualified_t<T>>::value) {
|
||||
auto pp = stack::push_pop(*this);
|
||||
type_assert(lua_state(), -1, type::userdata);
|
||||
|
@ -14223,7 +14244,7 @@ namespace sol {
|
|||
template <typename T, meta::enable<is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
||||
basic_userdata(lua_State* L, T&& r)
|
||||
: base_t(L, std::forward<T>(r)) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
auto pp = stack::push_pop(*this);
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_userdata>(L, -1, handler);
|
||||
|
@ -14231,14 +14252,14 @@ namespace sol {
|
|||
}
|
||||
basic_userdata(lua_State* L, int index = -1)
|
||||
: base_t(detail::no_safety, L, index) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_userdata>(L, index, handler);
|
||||
#endif // Safety
|
||||
}
|
||||
basic_userdata(lua_State* L, ref_index index)
|
||||
: base_t(detail::no_safety, L, index) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
auto pp = stack::push_pop(*this);
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_userdata>(L, -1, handler);
|
||||
|
@ -14257,7 +14278,7 @@ namespace sol {
|
|||
template <typename T, meta::enable<meta::neg<std::is_same<meta::unqualified_t<T>, basic_lightuserdata>>, meta::neg<std::is_same<base_t, stack_reference>>, is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
||||
basic_lightuserdata(T&& r) noexcept
|
||||
: base_t(std::forward<T>(r)) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
if (!is_lightuserdata<meta::unqualified_t<T>>::value) {
|
||||
auto pp = stack::push_pop(*this);
|
||||
type_assert(lua_state(), -1, type::lightuserdata);
|
||||
|
@ -14277,7 +14298,7 @@ namespace sol {
|
|||
template <typename T, meta::enable<is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
||||
basic_lightuserdata(lua_State* L, T&& r)
|
||||
: basic_lightuserdata(L, std::forward<T>(r)) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
auto pp = stack::push_pop(*this);
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_lightuserdata>(lua_state(), -1, handler);
|
||||
|
@ -14285,14 +14306,14 @@ namespace sol {
|
|||
}
|
||||
basic_lightuserdata(lua_State* L, int index = -1)
|
||||
: base_t(L, index) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_lightuserdata>(L, index, handler);
|
||||
#endif // Safety
|
||||
}
|
||||
basic_lightuserdata(lua_State* L, ref_index index)
|
||||
: base_t(L, index) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
auto pp = stack::push_pop(*this);
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_lightuserdata>(lua_state(), index, handler);
|
||||
|
@ -18242,7 +18263,7 @@ namespace sol {
|
|||
template <typename T, meta::enable_any<is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
||||
basic_table_core(lua_State* L, T&& r)
|
||||
: base_t(L, std::forward<T>(r)) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
auto pp = stack::push_pop(*this);
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_table_core>(lua_state(), -1, handler);
|
||||
|
@ -18256,14 +18277,14 @@ namespace sol {
|
|||
}
|
||||
basic_table_core(lua_State* L, int index = -1)
|
||||
: basic_table_core(detail::no_safety, L, index) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_table_core>(L, index, handler);
|
||||
#endif // Safety
|
||||
}
|
||||
basic_table_core(lua_State* L, ref_index index)
|
||||
: basic_table_core(detail::no_safety, L, index) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
auto pp = stack::push_pop(*this);
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_table_core>(lua_state(), -1, handler);
|
||||
|
@ -18272,7 +18293,7 @@ namespace sol {
|
|||
template <typename T, meta::enable<meta::neg<meta::any_same<meta::unqualified_t<T>, basic_table_core>>, meta::neg<std::is_same<base_type, stack_reference>>, is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
||||
basic_table_core(T&& r) noexcept
|
||||
: basic_table_core(detail::no_safety, std::forward<T>(r)) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
if (!is_table<meta::unqualified_t<T>>::value) {
|
||||
auto pp = stack::push_pop(*this);
|
||||
constructor_handler handler{};
|
||||
|
@ -18682,7 +18703,7 @@ namespace sol {
|
|||
|
||||
basic_environment(env_t, const stack_reference& extraction_target)
|
||||
: base_t(detail::no_safety, extraction_target.lua_state(), (stack::push_environment_of(extraction_target), -1)) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
constructor_handler handler{};
|
||||
stack::check<env_t>(this->lua_state(), -1, handler);
|
||||
#endif // Safety
|
||||
|
@ -18691,7 +18712,7 @@ namespace sol {
|
|||
template <bool b>
|
||||
basic_environment(env_t, const basic_reference<b>& extraction_target)
|
||||
: base_t(detail::no_safety, extraction_target.lua_state(), (stack::push_environment_of(extraction_target), -1)) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
constructor_handler handler{};
|
||||
stack::check<env_t>(this->lua_state(), -1, handler);
|
||||
#endif // Safety
|
||||
|
@ -18699,14 +18720,14 @@ namespace sol {
|
|||
}
|
||||
basic_environment(lua_State* L, int index = -1)
|
||||
: base_t(detail::no_safety, L, index) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_environment>(L, index, handler);
|
||||
#endif // Safety
|
||||
}
|
||||
basic_environment(lua_State* L, ref_index index)
|
||||
: base_t(detail::no_safety, L, index) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
auto pp = stack::push_pop(*this);
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_environment>(L, -1, handler);
|
||||
|
@ -18715,7 +18736,7 @@ namespace sol {
|
|||
template <typename T, meta::enable<meta::neg<meta::any_same<meta::unqualified_t<T>, basic_environment>>, meta::neg<std::is_same<base_type, stack_reference>>, is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
||||
basic_environment(T&& r) noexcept
|
||||
: base_t(detail::no_safety, std::forward<T>(r)) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
if (!is_environment<meta::unqualified_t<T>>::value) {
|
||||
auto pp = stack::push_pop(*this);
|
||||
constructor_handler handler{};
|
||||
|
@ -18726,7 +18747,7 @@ namespace sol {
|
|||
template <typename T, meta::enable<is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
||||
basic_environment(lua_State* L, T&& r) noexcept
|
||||
: base_t(detail::no_safety, L, std::forward<T>(r)) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
if (!is_environment<meta::unqualified_t<T>>::value) {
|
||||
auto pp = stack::push_pop(*this);
|
||||
constructor_handler handler{};
|
||||
|
@ -18864,9 +18885,9 @@ namespace sol {
|
|||
|
||||
template <typename T>
|
||||
decltype(auto) tagged_get(types<T>) const {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_PROXIES
|
||||
if (!valid()) {
|
||||
type_panic_c_str(L, index, type_of(L, index), type::none, "");
|
||||
type_panic_c_str(L, index, type_of(L, index), type::none);
|
||||
}
|
||||
#endif // Check Argument Safety
|
||||
return stack::get<T>(L, index);
|
||||
|
@ -18880,9 +18901,9 @@ namespace sol {
|
|||
}
|
||||
|
||||
error tagged_get(types<error>) const {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_PROXIES
|
||||
if (valid()) {
|
||||
type_panic_c_str(L, index, type_of(L, index), type::none);
|
||||
type_panic_c_str(L, index, type_of(L, index), type::none, "expecting an error type (a string, from Lua)");
|
||||
}
|
||||
#endif // Check Argument Safety
|
||||
return error(detail::direct_error, stack::get<std::string>(L, index));
|
||||
|
@ -19736,7 +19757,7 @@ namespace sol {
|
|||
template <typename T, meta::enable<meta::neg<std::is_same<meta::unqualified_t<T>, basic_thread>>, is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
||||
basic_thread(T&& r)
|
||||
: base_t(std::forward<T>(r)) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
auto pp = stack::push_pop(*this);
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_thread>(lua_state(), -1, handler);
|
||||
|
@ -19751,7 +19772,7 @@ namespace sol {
|
|||
template <typename T, meta::enable<is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
||||
basic_thread(lua_State* L, T&& r)
|
||||
: base_t(L, std::forward<T>(r)) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
auto pp = stack::push_pop(*this);
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_thread>(lua_state(), -1, handler);
|
||||
|
@ -19759,14 +19780,14 @@ namespace sol {
|
|||
}
|
||||
basic_thread(lua_State* L, int index = -1)
|
||||
: base_t(L, index) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_thread>(L, index, handler);
|
||||
#endif // Safety
|
||||
}
|
||||
basic_thread(lua_State* L, ref_index index)
|
||||
: base_t(L, index) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
auto pp = stack::push_pop(*this);
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_thread>(lua_state(), -1, handler);
|
||||
|
@ -19780,7 +19801,7 @@ namespace sol {
|
|||
}
|
||||
basic_thread(lua_State* L, lua_thread_state actualthread)
|
||||
: base_t(L, -stack::push(L, actualthread)) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_thread>(lua_state(), -1, handler);
|
||||
#endif // Safety
|
||||
|
@ -19977,7 +19998,7 @@ namespace sol {
|
|||
template <typename T, meta::enable<is_lua_reference<meta::unqualified_t<T>>> = meta::enabler>
|
||||
basic_coroutine(lua_State* L, T&& r)
|
||||
: base_t(L, std::forward<T>(r)) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
auto pp = stack::push_pop(*this);
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_coroutine>(lua_state(), -1, handler);
|
||||
|
@ -19985,14 +20006,14 @@ namespace sol {
|
|||
}
|
||||
basic_coroutine(lua_State* L, int index = -1)
|
||||
: base_t(L, index) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_coroutine>(lua_state(), index, handler);
|
||||
#endif // Safety
|
||||
}
|
||||
basic_coroutine(lua_State* L, ref_index index)
|
||||
: base_t(L, index) {
|
||||
#ifdef SOL_CHECK_ARGUMENTS
|
||||
#ifdef SOL_SAFE_REFERENCES
|
||||
auto pp = stack::push_pop(*this);
|
||||
constructor_handler handler{};
|
||||
stack::check<basic_coroutine>(lua_state(), -1, handler);
|
||||
|
|
|
@ -41,9 +41,10 @@ namespace sol {
|
|||
|
||||
template <typename T>
|
||||
decltype(auto) tagged_get(types<optional<T>>, int index_offset) const {
|
||||
typedef decltype(stack::get<optional<T>>(L, index)) ret_t;
|
||||
int target = index + index_offset;
|
||||
if (!valid()) {
|
||||
return optional<T>(nullopt);
|
||||
return ret_t(nullopt);
|
||||
}
|
||||
return stack::get<optional<T>>(L, target);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user