mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Get rid of MSVC problems and improve state API.
- Just let MSVC have crap codegen. The compiler sucks anyways. Fixes - Add incremental GC power. Fixes #997. - Add non-null offset manipulation. Did I mention I hate VC++ and how it implemented _Aligned? Fixes #1017.
This commit is contained in:
parent
de87bec171
commit
63df43e061
@ -28,14 +28,19 @@
|
|||||||
#include <sol/call.hpp>
|
#include <sol/call.hpp>
|
||||||
#include <sol/bind_traits.hpp>
|
#include <sol/bind_traits.hpp>
|
||||||
|
|
||||||
namespace sol {
|
namespace sol { namespace function_detail {
|
||||||
namespace function_detail {
|
|
||||||
template <typename Function, bool is_yielding>
|
template <typename Function, bool is_yielding>
|
||||||
struct upvalue_free_function {
|
struct upvalue_free_function {
|
||||||
using function_type = std::remove_pointer_t<std::decay_t<Function>>;
|
using function_type = std::remove_pointer_t<std::decay_t<Function>>;
|
||||||
using traits_type = meta::bind_traits<function_type>;
|
using traits_type = meta::bind_traits<function_type>;
|
||||||
|
|
||||||
static int real_call(lua_State* L) noexcept(traits_type::is_noexcept) {
|
static int real_call(lua_State* L)
|
||||||
|
#if SOL_IS_ON(SOL_COMPILER_VCXX_I_)
|
||||||
|
// MSVC is broken, what a surprise...
|
||||||
|
#else
|
||||||
|
noexcept(traits_type::is_noexcept)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
auto udata = stack::stack_detail::get_as_upvalues<function_type*>(L);
|
auto udata = stack::stack_detail::get_as_upvalues<function_type*>(L);
|
||||||
function_type* fx = udata.first;
|
function_type* fx = udata.first;
|
||||||
return call_detail::call_wrapped<void, true, false>(L, fx);
|
return call_detail::call_wrapped<void, true, false>(L, fx);
|
||||||
@ -61,7 +66,13 @@ namespace function_detail {
|
|||||||
typedef std::remove_pointer_t<std::decay_t<Function>> function_type;
|
typedef std::remove_pointer_t<std::decay_t<Function>> function_type;
|
||||||
typedef lua_bind_traits<function_type> traits_type;
|
typedef lua_bind_traits<function_type> traits_type;
|
||||||
|
|
||||||
static int real_call(lua_State* L) noexcept(traits_type::is_noexcept) {
|
static int real_call(lua_State* L)
|
||||||
|
#if SOL_IS_ON(SOL_COMPILER_VCXX_I_)
|
||||||
|
// MSVC is broken, what a surprise...
|
||||||
|
#else
|
||||||
|
noexcept(traits_type::is_noexcept)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
// Layout:
|
// Layout:
|
||||||
// idx 1...n: verbatim data of member function pointer
|
// idx 1...n: verbatim data of member function pointer
|
||||||
// idx n + 1: is the object's void pointer
|
// idx n + 1: is the object's void pointer
|
||||||
@ -72,7 +83,13 @@ namespace function_detail {
|
|||||||
return call_detail::call_wrapped<T, true, false, -1>(L, memfx, item);
|
return call_detail::call_wrapped<T, true, false, -1>(L, memfx, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int call(lua_State* L) noexcept(traits_type::is_noexcept) {
|
static int call(lua_State* L)
|
||||||
|
#if SOL_IS_ON(SOL_COMPILER_VCXX_I_)
|
||||||
|
// MSVC is broken, what a surprise...
|
||||||
|
#else
|
||||||
|
noexcept(traits_type::is_noexcept)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
int nr = detail::typed_static_trampoline<decltype(&real_call), (&real_call)>(L);
|
int nr = detail::typed_static_trampoline<decltype(&real_call), (&real_call)>(L);
|
||||||
if (is_yielding) {
|
if (is_yielding) {
|
||||||
return lua_yield(L, nr);
|
return lua_yield(L, nr);
|
||||||
@ -92,7 +109,13 @@ namespace function_detail {
|
|||||||
typedef std::remove_pointer_t<std::decay_t<Function>> function_type;
|
typedef std::remove_pointer_t<std::decay_t<Function>> function_type;
|
||||||
typedef lua_bind_traits<function_type> traits_type;
|
typedef lua_bind_traits<function_type> traits_type;
|
||||||
|
|
||||||
static int real_call(lua_State* L) noexcept(traits_type::is_noexcept) {
|
static int real_call(lua_State* L)
|
||||||
|
#if SOL_IS_ON(SOL_COMPILER_VCXX_I_)
|
||||||
|
// MSVC is broken, what a surprise...
|
||||||
|
#else
|
||||||
|
noexcept(traits_type::is_noexcept)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
// Layout:
|
// Layout:
|
||||||
// idx 1...n: verbatim data of member variable pointer
|
// idx 1...n: verbatim data of member variable pointer
|
||||||
// idx n + 1: is the object's void pointer
|
// idx n + 1: is the object's void pointer
|
||||||
@ -112,7 +135,13 @@ namespace function_detail {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int call(lua_State* L) noexcept(traits_type::is_noexcept) {
|
static int call(lua_State* L)
|
||||||
|
#if SOL_IS_ON(SOL_COMPILER_VCXX_I_)
|
||||||
|
// MSVC is broken, what a surprise...
|
||||||
|
#else
|
||||||
|
noexcept(traits_type::is_noexcept)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
int nr = detail::typed_static_trampoline<decltype(&real_call), (&real_call)>(L);
|
int nr = detail::typed_static_trampoline<decltype(&real_call), (&real_call)>(L);
|
||||||
if (is_yielding) {
|
if (is_yielding) {
|
||||||
return lua_yield(L, nr);
|
return lua_yield(L, nr);
|
||||||
@ -132,7 +161,13 @@ namespace function_detail {
|
|||||||
typedef std::remove_pointer_t<std::decay_t<Function>> function_type;
|
typedef std::remove_pointer_t<std::decay_t<Function>> function_type;
|
||||||
typedef lua_bind_traits<function_type> traits_type;
|
typedef lua_bind_traits<function_type> traits_type;
|
||||||
|
|
||||||
static int real_call(lua_State* L) noexcept(traits_type::is_noexcept) {
|
static int real_call(lua_State* L)
|
||||||
|
#if SOL_IS_ON(SOL_COMPILER_VCXX_I_)
|
||||||
|
// MSVC is broken, what a surprise...
|
||||||
|
#else
|
||||||
|
noexcept(traits_type::is_noexcept)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
// Layout:
|
// Layout:
|
||||||
// idx 1...n: verbatim data of member variable pointer
|
// idx 1...n: verbatim data of member variable pointer
|
||||||
// idx n + 1: is the object's void pointer
|
// idx n + 1: is the object's void pointer
|
||||||
@ -150,7 +185,13 @@ namespace function_detail {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int call(lua_State* L) {
|
static int call(lua_State* L)
|
||||||
|
#if SOL_IS_ON(SOL_COMPILER_VCXX_I_)
|
||||||
|
// MSVC is broken, what a surprise...
|
||||||
|
#else
|
||||||
|
noexcept(traits_type::is_noexcept)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
int nr = detail::typed_static_trampoline<decltype(&real_call), (&real_call)>(L);
|
int nr = detail::typed_static_trampoline<decltype(&real_call), (&real_call)>(L);
|
||||||
if (is_yielding) {
|
if (is_yielding) {
|
||||||
return lua_yield(L, nr);
|
return lua_yield(L, nr);
|
||||||
@ -170,14 +211,26 @@ namespace function_detail {
|
|||||||
typedef std::remove_pointer_t<std::decay_t<Function>> function_type;
|
typedef std::remove_pointer_t<std::decay_t<Function>> function_type;
|
||||||
typedef lua_bind_traits<function_type> traits_type;
|
typedef lua_bind_traits<function_type> traits_type;
|
||||||
|
|
||||||
static int real_call(lua_State* L) noexcept(traits_type::is_noexcept) {
|
static int real_call(lua_State* L)
|
||||||
|
#if SOL_IS_ON(SOL_COMPILER_VCXX_I_)
|
||||||
|
// MSVC is broken, what a surprise...
|
||||||
|
#else
|
||||||
|
noexcept(traits_type::is_noexcept)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
// Layout:
|
// Layout:
|
||||||
// idx 1...n: verbatim data of member variable pointer
|
// idx 1...n: verbatim data of member variable pointer
|
||||||
function_type& memfx = stack::get<user<function_type>>(L, upvalue_index(2));
|
function_type& memfx = stack::get<user<function_type>>(L, upvalue_index(2));
|
||||||
return call_detail::call_wrapped<T, false, false>(L, memfx);
|
return call_detail::call_wrapped<T, false, false>(L, memfx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int call(lua_State* L) {
|
static int call(lua_State* L)
|
||||||
|
#if SOL_IS_ON(SOL_COMPILER_VCXX_I_)
|
||||||
|
// MSVC is broken, what a surprise...
|
||||||
|
#else
|
||||||
|
noexcept(traits_type::is_noexcept)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
int nr = detail::typed_static_trampoline<decltype(&real_call), (&real_call)>(L);
|
int nr = detail::typed_static_trampoline<decltype(&real_call), (&real_call)>(L);
|
||||||
if (is_yielding) {
|
if (is_yielding) {
|
||||||
return lua_yield(L, nr);
|
return lua_yield(L, nr);
|
||||||
@ -258,7 +311,6 @@ namespace function_detail {
|
|||||||
return call(L);
|
return call(L);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}} // namespace sol::function_detail
|
||||||
} // namespace sol::function_detail
|
|
||||||
|
|
||||||
#endif // SOL_FUNCTION_TYPES_STATELESS_HPP
|
#endif // SOL_FUNCTION_TYPES_STATELESS_HPP
|
||||||
|
@ -46,16 +46,16 @@
|
|||||||
|
|
||||||
namespace sol {
|
namespace sol {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
struct with_function_tag {};
|
struct with_function_tag { };
|
||||||
struct as_reference_tag {};
|
struct as_reference_tag { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct as_pointer_tag {};
|
struct as_pointer_tag { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct as_value_tag {};
|
struct as_value_tag { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct as_unique_tag {};
|
struct as_unique_tag { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct as_table_tag {};
|
struct as_table_tag { };
|
||||||
|
|
||||||
using lua_reg_table = luaL_Reg[64];
|
using lua_reg_table = luaL_Reg[64];
|
||||||
|
|
||||||
@ -92,7 +92,9 @@ namespace sol {
|
|||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
std::size_t aligned_space_for(void* alignment = nullptr) {
|
std::size_t aligned_space_for(void* alignment = nullptr) {
|
||||||
char* start = static_cast<char*>(alignment);
|
// use temporary storage to prevent strict UB shenanigans
|
||||||
|
char alignment_shim[(std::max)({ sizeof(Args)... }) + (std::max)({ alignof(Args)... })] {};
|
||||||
|
char* start = alignment == nullptr ? static_cast<char*>(alignment) : alignment_shim;
|
||||||
(void)detail::swallow { int {}, (align_one(std::alignment_of_v<Args>, sizeof(Args), alignment), int {})... };
|
(void)detail::swallow { int {}, (align_one(std::alignment_of_v<Args>, sizeof(Args), alignment), int {})... };
|
||||||
return static_cast<char*>(alignment) - start;
|
return static_cast<char*>(alignment) - start;
|
||||||
}
|
}
|
||||||
@ -1423,24 +1425,24 @@ namespace sol {
|
|||||||
void insert_default_registrations(IFx&& ifx, Fx&& fx);
|
void insert_default_registrations(IFx&& ifx, Fx&& fx);
|
||||||
|
|
||||||
template <typename T, bool, bool>
|
template <typename T, bool, bool>
|
||||||
struct get_is_primitive : is_lua_primitive<T> {};
|
struct get_is_primitive : is_lua_primitive<T> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct get_is_primitive<T, true, false>
|
struct get_is_primitive<T, true, false>
|
||||||
: meta::neg<std::is_reference<decltype(sol_lua_get(types<T>(), nullptr, -1, std::declval<stack::record&>()))>> {};
|
: meta::neg<std::is_reference<decltype(sol_lua_get(types<T>(), nullptr, -1, std::declval<stack::record&>()))>> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct get_is_primitive<T, false, true>
|
struct get_is_primitive<T, false, true>
|
||||||
: meta::neg<std::is_reference<decltype(sol_lua_get(types<meta::unqualified_t<T>>(), nullptr, -1, std::declval<stack::record&>()))>> {};
|
: meta::neg<std::is_reference<decltype(sol_lua_get(types<meta::unqualified_t<T>>(), nullptr, -1, std::declval<stack::record&>()))>> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct get_is_primitive<T, true, true> : get_is_primitive<T, true, false> {};
|
struct get_is_primitive<T, true, true> : get_is_primitive<T, true, false> { };
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_proxy_primitive
|
struct is_proxy_primitive
|
||||||
: detail::get_is_primitive<T, meta::meta_detail::is_adl_sol_lua_get_v<T>, meta::meta_detail::is_adl_sol_lua_get_v<meta::unqualified_t<T>>> {};
|
: detail::get_is_primitive<T, meta::meta_detail::is_adl_sol_lua_get_v<T>, meta::meta_detail::is_adl_sol_lua_get_v<meta::unqualified_t<T>>> { };
|
||||||
|
|
||||||
} // namespace sol
|
} // namespace sol
|
||||||
|
|
||||||
|
@ -637,10 +637,88 @@ namespace sol {
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool supports_gc_mode(gc_mode mode) const noexcept {
|
||||||
|
#if SOL_LUA_VERSION >= 504
|
||||||
|
// supports all modes
|
||||||
|
(void)mode;
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
return mode == gc_mode::default;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_gc_on() const {
|
||||||
|
return lua_gc(lua_state(), LUA_GCISRUNNING, 0) == 1;
|
||||||
|
}
|
||||||
|
|
||||||
void collect_garbage() {
|
void collect_garbage() {
|
||||||
lua_gc(lua_state(), LUA_GCCOLLECT, 0);
|
lua_gc(lua_state(), LUA_GCCOLLECT, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void collect_gc() {
|
||||||
|
collect_garbage();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool step_gc(int step_size_kilobytes) {
|
||||||
|
// THOUGHT: std::chrono-alikes to map "kilobyte size" here...?
|
||||||
|
// Make it harder to give MB or KB to a B parameter...?
|
||||||
|
// Probably overkill for now.
|
||||||
|
#if SOL_LUA_VERSION >= 504
|
||||||
|
// The manual implies that this function is almost always successful...
|
||||||
|
// is it?? It could depend on the GC mode...
|
||||||
|
return lua_gc(lua_state(), LUA_GCSTEP, step_size_kilobytes) != 0;
|
||||||
|
#else
|
||||||
|
return lua_gc(lua_state(), LUA_GCSTEP, step_size_kilobytes) == 1;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void restart_gc() {
|
||||||
|
lua_gc(lua_state(), LUA_GCRESTART, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void stop_gc() {
|
||||||
|
lua_gc(lua_state(), LUA_GCSTOP, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the old GC mode. Check support using the supports_gc_mode function.
|
||||||
|
gc_mode change_gc_mode_incremental(int pause, int step_multiplier, int step_byte_size) {
|
||||||
|
// "What the fuck does any of this mean??"
|
||||||
|
// http://www.lua.org/manual/5.4/manual.html#2.5.1
|
||||||
|
|
||||||
|
// THOUGHT: std::chrono-alikes to map "byte size" here...?
|
||||||
|
// Make it harder to give MB or KB to a B parameter...?
|
||||||
|
// Probably overkill for now.
|
||||||
|
#if SOL_LUA_VERSION >= 504
|
||||||
|
int old_mode = lua_gc(lua_state(), LUA_GCINC, pause, step_multiplier, step_byte_size);
|
||||||
|
if (old_mode == LUA_GCGEN) {
|
||||||
|
return gc_mode::generational;
|
||||||
|
}
|
||||||
|
else if (old_mode == LUA_GCINC) {
|
||||||
|
return gc_mode::incremental;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
lua_gc(lua_state(), LUA_GCSETPAUSE, pause);
|
||||||
|
lua_gc(lua_state(), LUA_GCSETSTEPMUL, step_multiplier);
|
||||||
|
(void)step_byte_size; // means nothing in older versions
|
||||||
|
#endif
|
||||||
|
return gc_mode::default;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the old GC mode. Check support using the supports_gc_mode function.
|
||||||
|
gc_mode change_gc_mode_generational(int minor_multiplier, int major_multiplier) {
|
||||||
|
#if SOL_LUA_VERSION >= 504
|
||||||
|
// "What does this shit mean?"
|
||||||
|
// http://www.lua.org/manual/5.4/manual.html#2.5.2
|
||||||
|
int old_mode = lua_gc(lua_state(), LUA_GCGEN, minor_multiplier, major_multiplier);
|
||||||
|
if (old_mode == LUA_GCGEN) {
|
||||||
|
return gc_mode::generational;
|
||||||
|
}
|
||||||
|
else if (old_mode == LUA_GCINC) {
|
||||||
|
return gc_mode::incremental;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return gc_mode::default;
|
||||||
|
}
|
||||||
|
|
||||||
operator lua_State*() const {
|
operator lua_State*() const {
|
||||||
return lua_state();
|
return lua_state();
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ namespace sol {
|
|||||||
#endif // noexcept function type for lua_CFunction
|
#endif // noexcept function type for lua_CFunction
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct unique_usertype {};
|
struct unique_usertype { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct implicit_wrapper {
|
struct implicit_wrapper {
|
||||||
@ -70,11 +70,11 @@ namespace sol {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct yield_tag_t {};
|
struct yield_tag_t { };
|
||||||
const yield_tag_t yield_tag = yield_tag_t {};
|
const yield_tag_t yield_tag = yield_tag_t {};
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
struct lua_nil_t {};
|
struct lua_nil_t { };
|
||||||
inline constexpr lua_nil_t lua_nil {};
|
inline constexpr lua_nil_t lua_nil {};
|
||||||
inline bool operator==(lua_nil_t, lua_nil_t) {
|
inline bool operator==(lua_nil_t, lua_nil_t) {
|
||||||
return true;
|
return true;
|
||||||
@ -88,16 +88,16 @@ namespace sol {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
struct non_lua_nil_t {};
|
struct non_lua_nil_t { };
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
struct metatable_key_t {};
|
struct metatable_key_t { };
|
||||||
const metatable_key_t metatable_key = {};
|
const metatable_key_t metatable_key = {};
|
||||||
|
|
||||||
struct env_key_t {};
|
struct env_key_t { };
|
||||||
const env_key_t env_key = {};
|
const env_key_t env_key = {};
|
||||||
|
|
||||||
struct no_metatable_t {};
|
struct no_metatable_t { };
|
||||||
const no_metatable_t no_metatable = {};
|
const no_metatable_t no_metatable = {};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -127,10 +127,10 @@ namespace sol {
|
|||||||
typedef std::remove_pointer_t<lua_CFunction> lua_CFunction_ref;
|
typedef std::remove_pointer_t<lua_CFunction> lua_CFunction_ref;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct non_null {};
|
struct non_null { };
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
struct function_sig {};
|
struct function_sig { };
|
||||||
|
|
||||||
struct upvalue_index {
|
struct upvalue_index {
|
||||||
int index;
|
int index;
|
||||||
@ -233,7 +233,7 @@ namespace sol {
|
|||||||
operator std::add_lvalue_reference_t<U>() {
|
operator std::add_lvalue_reference_t<U>() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
operator std::add_const_t<std::add_lvalue_reference_t<U>>&() const {
|
operator std::add_const_t<std::add_lvalue_reference_t<U>> &() const {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -375,7 +375,7 @@ namespace sol {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nested_tag_t {};
|
struct nested_tag_t { };
|
||||||
constexpr inline nested_tag_t nested_tag {};
|
constexpr inline nested_tag_t nested_tag {};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -506,11 +506,11 @@ namespace sol {
|
|||||||
return push_invoke_t<Fx>(std::forward<Fx>(fx));
|
return push_invoke_t<Fx>(std::forward<Fx>(fx));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct override_value_t {};
|
struct override_value_t { };
|
||||||
constexpr inline override_value_t override_value = override_value_t();
|
constexpr inline override_value_t override_value = override_value_t();
|
||||||
struct update_if_empty_t {};
|
struct update_if_empty_t { };
|
||||||
constexpr inline update_if_empty_t update_if_empty = update_if_empty_t();
|
constexpr inline update_if_empty_t update_if_empty = update_if_empty_t();
|
||||||
struct create_if_nil_t {};
|
struct create_if_nil_t { };
|
||||||
constexpr inline create_if_nil_t create_if_nil = create_if_nil_t();
|
constexpr inline create_if_nil_t create_if_nil = create_if_nil_t();
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
@ -646,6 +646,12 @@ namespace sol {
|
|||||||
file = LUA_ERRFILE,
|
file = LUA_ERRFILE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class gc_mode : int {
|
||||||
|
incremental = 0,
|
||||||
|
generational = 1,
|
||||||
|
default = incremental,
|
||||||
|
};
|
||||||
|
|
||||||
enum class type : int {
|
enum class type : int {
|
||||||
none = LUA_TNONE,
|
none = LUA_TNONE,
|
||||||
lua_nil = LUA_TNIL,
|
lua_nil = LUA_TNIL,
|
||||||
@ -848,33 +854,33 @@ namespace sol {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_reference
|
struct is_lua_reference
|
||||||
: std::integral_constant<bool, std::is_base_of_v<reference, T> || std::is_base_of_v<main_reference, T> || std::is_base_of_v<stack_reference, T>> {};
|
: std::integral_constant<bool, std::is_base_of_v<reference, T> || std::is_base_of_v<main_reference, T> || std::is_base_of_v<stack_reference, T>> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline constexpr bool is_lua_reference_v = is_lua_reference<T>::value;
|
inline constexpr bool is_lua_reference_v = is_lua_reference<T>::value;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_reference_or_proxy : std::integral_constant<bool, is_lua_reference_v<T> || meta::is_specialization_of_v<T, table_proxy>> {};
|
struct is_lua_reference_or_proxy : std::integral_constant<bool, is_lua_reference_v<T> || meta::is_specialization_of_v<T, table_proxy>> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline constexpr bool is_lua_reference_or_proxy_v = is_lua_reference_or_proxy<T>::value;
|
inline constexpr bool is_lua_reference_or_proxy_v = is_lua_reference_or_proxy<T>::value;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_transparent_argument : std::false_type {};
|
struct is_transparent_argument : std::false_type { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
constexpr inline bool is_transparent_argument_v = is_transparent_argument<T>::value;
|
constexpr inline bool is_transparent_argument_v = is_transparent_argument<T>::value;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct is_transparent_argument<this_state> : std::true_type {};
|
struct is_transparent_argument<this_state> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_transparent_argument<this_main_state> : std::true_type {};
|
struct is_transparent_argument<this_main_state> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_transparent_argument<this_environment> : std::true_type {};
|
struct is_transparent_argument<this_environment> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_transparent_argument<variadic_args> : std::true_type {};
|
struct is_transparent_argument<variadic_args> : std::true_type { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_variadic_arguments : std::is_same<T, variadic_args> {};
|
struct is_variadic_arguments : std::is_same<T, variadic_args> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_container
|
struct is_container
|
||||||
@ -888,221 +894,221 @@ namespace sol {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_to_stringable : meta::any<meta::supports_to_string_member<meta::unqualified_t<T>>, meta::supports_adl_to_string<meta::unqualified_t<T>>,
|
struct is_to_stringable : meta::any<meta::supports_to_string_member<meta::unqualified_t<T>>, meta::supports_adl_to_string<meta::unqualified_t<T>>,
|
||||||
meta::supports_op_left_shift<std::ostream, meta::unqualified_t<T>>> {};
|
meta::supports_op_left_shift<std::ostream, meta::unqualified_t<T>>> { };
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template <typename T, typename = void>
|
template <typename T, typename = void>
|
||||||
struct lua_type_of : std::integral_constant<type, type::userdata> {};
|
struct lua_type_of : std::integral_constant<type, type::userdata> { };
|
||||||
|
|
||||||
template <typename C, typename T, typename A>
|
template <typename C, typename T, typename A>
|
||||||
struct lua_type_of<std::basic_string<C, T, A>> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<std::basic_string<C, T, A>> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <typename C, typename T>
|
template <typename C, typename T>
|
||||||
struct lua_type_of<basic_string_view<C, T>> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<basic_string_view<C, T>> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <std::size_t N>
|
template <std::size_t N>
|
||||||
struct lua_type_of<char[N]> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<char[N]> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <std::size_t N>
|
template <std::size_t N>
|
||||||
struct lua_type_of<wchar_t[N]> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<wchar_t[N]> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <std::size_t N>
|
template <std::size_t N>
|
||||||
struct lua_type_of<char16_t[N]> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<char16_t[N]> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <std::size_t N>
|
template <std::size_t N>
|
||||||
struct lua_type_of<char32_t[N]> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<char32_t[N]> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<char> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<char> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<wchar_t> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<wchar_t> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<char16_t> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<char16_t> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<char32_t> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<char32_t> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<const char*> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<const char*> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<const char16_t*> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<const char16_t*> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<const char32_t*> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<const char32_t*> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<bool> : std::integral_constant<type, type::boolean> {};
|
struct lua_type_of<bool> : std::integral_constant<type, type::boolean> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<lua_nil_t> : std::integral_constant<type, type::lua_nil> {};
|
struct lua_type_of<lua_nil_t> : std::integral_constant<type, type::lua_nil> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<nullopt_t> : std::integral_constant<type, type::lua_nil> {};
|
struct lua_type_of<nullopt_t> : std::integral_constant<type, type::lua_nil> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<lua_value> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<lua_value> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<detail::non_lua_nil_t> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<detail::non_lua_nil_t> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<std::nullptr_t> : std::integral_constant<type, type::lua_nil> {};
|
struct lua_type_of<std::nullptr_t> : std::integral_constant<type, type::lua_nil> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<error> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<error> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <bool b, typename Base>
|
template <bool b, typename Base>
|
||||||
struct lua_type_of<basic_table_core<b, Base>> : std::integral_constant<type, type::table> {};
|
struct lua_type_of<basic_table_core<b, Base>> : std::integral_constant<type, type::table> { };
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
struct lua_type_of<basic_lua_table<Base>> : std::integral_constant<type, type::table> {};
|
struct lua_type_of<basic_lua_table<Base>> : std::integral_constant<type, type::table> { };
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
struct lua_type_of<basic_metatable<Base>> : std::integral_constant<type, type::table> {};
|
struct lua_type_of<basic_metatable<Base>> : std::integral_constant<type, type::table> { };
|
||||||
|
|
||||||
template <typename T, typename Base>
|
template <typename T, typename Base>
|
||||||
struct lua_type_of<basic_usertype<T, Base>> : std::integral_constant<type, type::table> {};
|
struct lua_type_of<basic_usertype<T, Base>> : std::integral_constant<type, type::table> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<metatable_key_t> : std::integral_constant<type, type::table> {};
|
struct lua_type_of<metatable_key_t> : std::integral_constant<type, type::table> { };
|
||||||
|
|
||||||
template <typename B>
|
template <typename B>
|
||||||
struct lua_type_of<basic_environment<B>> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<basic_environment<B>> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<env_key_t> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<env_key_t> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<new_table> : std::integral_constant<type, type::table> {};
|
struct lua_type_of<new_table> : std::integral_constant<type, type::table> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct lua_type_of<as_table_t<T>> : std::integral_constant<type, type::table> {};
|
struct lua_type_of<as_table_t<T>> : std::integral_constant<type, type::table> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct lua_type_of<std::initializer_list<T>> : std::integral_constant<type, type::table> {};
|
struct lua_type_of<std::initializer_list<T>> : std::integral_constant<type, type::table> { };
|
||||||
|
|
||||||
template <bool b>
|
template <bool b>
|
||||||
struct lua_type_of<basic_reference<b>> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<basic_reference<b>> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<stack_reference> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<stack_reference> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
struct lua_type_of<basic_object<Base>> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<basic_object<Base>> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
struct lua_type_of<std::tuple<Args...>> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<std::tuple<Args...>> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <typename A, typename B>
|
template <typename A, typename B>
|
||||||
struct lua_type_of<std::pair<A, B>> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<std::pair<A, B>> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<void*> : std::integral_constant<type, type::lightuserdata> {};
|
struct lua_type_of<void*> : std::integral_constant<type, type::lightuserdata> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<const void*> : std::integral_constant<type, type::lightuserdata> {};
|
struct lua_type_of<const void*> : std::integral_constant<type, type::lightuserdata> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<lightuserdata_value> : std::integral_constant<type, type::lightuserdata> {};
|
struct lua_type_of<lightuserdata_value> : std::integral_constant<type, type::lightuserdata> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<userdata_value> : std::integral_constant<type, type::userdata> {};
|
struct lua_type_of<userdata_value> : std::integral_constant<type, type::userdata> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct lua_type_of<light<T>> : std::integral_constant<type, type::lightuserdata> {};
|
struct lua_type_of<light<T>> : std::integral_constant<type, type::lightuserdata> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct lua_type_of<user<T>> : std::integral_constant<type, type::userdata> {};
|
struct lua_type_of<user<T>> : std::integral_constant<type, type::userdata> { };
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
struct lua_type_of<basic_lightuserdata<Base>> : std::integral_constant<type, type::lightuserdata> {};
|
struct lua_type_of<basic_lightuserdata<Base>> : std::integral_constant<type, type::lightuserdata> { };
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
struct lua_type_of<basic_userdata<Base>> : std::integral_constant<type, type::userdata> {};
|
struct lua_type_of<basic_userdata<Base>> : std::integral_constant<type, type::userdata> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<lua_CFunction> : std::integral_constant<type, type::function> {};
|
struct lua_type_of<lua_CFunction> : std::integral_constant<type, type::function> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<std::remove_pointer_t<lua_CFunction>> : std::integral_constant<type, type::function> {};
|
struct lua_type_of<std::remove_pointer_t<lua_CFunction>> : std::integral_constant<type, type::function> { };
|
||||||
|
|
||||||
template <typename Base, bool aligned>
|
template <typename Base, bool aligned>
|
||||||
struct lua_type_of<basic_function<Base, aligned>> : std::integral_constant<type, type::function> {};
|
struct lua_type_of<basic_function<Base, aligned>> : std::integral_constant<type, type::function> { };
|
||||||
|
|
||||||
template <typename Base, bool aligned, typename Handler>
|
template <typename Base, bool aligned, typename Handler>
|
||||||
struct lua_type_of<basic_protected_function<Base, aligned, Handler>> : std::integral_constant<type, type::function> {};
|
struct lua_type_of<basic_protected_function<Base, aligned, Handler>> : std::integral_constant<type, type::function> { };
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
struct lua_type_of<basic_coroutine<Base>> : std::integral_constant<type, type::function> {};
|
struct lua_type_of<basic_coroutine<Base>> : std::integral_constant<type, type::function> { };
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
struct lua_type_of<basic_thread<Base>> : std::integral_constant<type, type::thread> {};
|
struct lua_type_of<basic_thread<Base>> : std::integral_constant<type, type::thread> { };
|
||||||
|
|
||||||
template <typename Signature>
|
template <typename Signature>
|
||||||
struct lua_type_of<std::function<Signature>> : std::integral_constant<type, type::function> {};
|
struct lua_type_of<std::function<Signature>> : std::integral_constant<type, type::function> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct lua_type_of<optional<T>> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<optional<T>> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct lua_type_of<std::optional<T>> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<std::optional<T>> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<variadic_args> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<variadic_args> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<variadic_results> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<variadic_results> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<stack_count> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<stack_count> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<this_state> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<this_state> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<this_main_state> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<this_main_state> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<this_environment> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<this_environment> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<type> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<type> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct lua_type_of<T*> : std::integral_constant<type, type::userdata> {};
|
struct lua_type_of<T*> : std::integral_constant<type, type::userdata> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct lua_type_of<T, std::enable_if_t<std::is_arithmetic_v<T> || std::is_same_v<T, lua_Number> || std::is_same_v<T, lua_Integer>>>
|
struct lua_type_of<T, std::enable_if_t<std::is_arithmetic_v<T> || std::is_same_v<T, lua_Number> || std::is_same_v<T, lua_Integer>>>
|
||||||
: std::integral_constant<type, type::number> {};
|
: std::integral_constant<type, type::number> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct lua_type_of<T, std::enable_if_t<std::is_enum_v<T>>> : std::integral_constant<type, type::number> {};
|
struct lua_type_of<T, std::enable_if_t<std::is_enum_v<T>>> : std::integral_constant<type, type::number> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<meta_function> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<meta_function> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
#if SOL_IS_ON(SOL_STD_VARIANT_I_)
|
#if SOL_IS_ON(SOL_STD_VARIANT_I_)
|
||||||
template <typename... Tn>
|
template <typename... Tn>
|
||||||
struct lua_type_of<std::variant<Tn...>> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<std::variant<Tn...>> : std::integral_constant<type, type::poly> { };
|
||||||
#endif // std::variant deployment sucks on Clang
|
#endif // std::variant deployment sucks on Clang
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct lua_type_of<nested<T>> : meta::conditional_t<::sol::is_container_v<T>, std::integral_constant<type, type::table>, lua_type_of<T>> {};
|
struct lua_type_of<nested<T>> : meta::conditional_t<::sol::is_container_v<T>, std::integral_constant<type, type::table>, lua_type_of<T>> { };
|
||||||
|
|
||||||
template <typename C, C v, template <typename...> class V, typename... Args>
|
template <typename C, C v, template <typename...> class V, typename... Args>
|
||||||
struct accumulate : std::integral_constant<C, v> {};
|
struct accumulate : std::integral_constant<C, v> { };
|
||||||
|
|
||||||
template <typename C, C v, template <typename...> class V, typename T, typename... Args>
|
template <typename C, C v, template <typename...> class V, typename T, typename... Args>
|
||||||
struct accumulate<C, v, V, T, Args...> : accumulate<C, v + V<T>::value, V, Args...> {};
|
struct accumulate<C, v, V, T, Args...> : accumulate<C, v + V<T>::value, V, Args...> { };
|
||||||
|
|
||||||
template <typename C, C v, template <typename...> class V, typename List>
|
template <typename C, C v, template <typename...> class V, typename List>
|
||||||
struct accumulate_list;
|
struct accumulate_list;
|
||||||
|
|
||||||
template <typename C, C v, template <typename...> class V, typename... Args>
|
template <typename C, C v, template <typename...> class V, typename... Args>
|
||||||
struct accumulate_list<C, v, V, types<Args...>> : accumulate<C, v, V, Args...> {};
|
struct accumulate_list<C, v, V, types<Args...>> : accumulate<C, v, V, Args...> { };
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -1119,10 +1125,10 @@ namespace sol {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename A, typename B>
|
template <typename A, typename B>
|
||||||
struct lua_size<std::pair<A, B>> : std::integral_constant<int, lua_size<A>::value + lua_size<B>::value> {};
|
struct lua_size<std::pair<A, B>> : std::integral_constant<int, lua_size<A>::value + lua_size<B>::value> { };
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
struct lua_size<std::tuple<Args...>> : std::integral_constant<int, detail::accumulate<int, 0, lua_size, Args...>::value> {};
|
struct lua_size<std::tuple<Args...>> : std::integral_constant<int, detail::accumulate<int, 0, lua_size, Args...>::value> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline constexpr int lua_size_v = lua_size<T>::value;
|
inline constexpr int lua_size_v = lua_size<T>::value;
|
||||||
@ -1133,9 +1139,9 @@ namespace sol {
|
|||||||
typedef void type;
|
typedef void type;
|
||||||
};
|
};
|
||||||
template <typename T, typename = void>
|
template <typename T, typename = void>
|
||||||
struct has_internal_marker_impl : std::false_type {};
|
struct has_internal_marker_impl : std::false_type { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct has_internal_marker_impl<T, typename void_<typename T::SOL_INTERNAL_UNSPECIALIZED_MARKER_>::type> : std::true_type {};
|
struct has_internal_marker_impl<T, typename void_<typename T::SOL_INTERNAL_UNSPECIALIZED_MARKER_>::type> : std::true_type { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
using has_internal_marker = has_internal_marker_impl<T>;
|
using has_internal_marker = has_internal_marker_impl<T>;
|
||||||
@ -1150,73 +1156,73 @@ namespace sol {
|
|||||||
type::userdata
|
type::userdata
|
||||||
!= lua_type_of_v<
|
!= lua_type_of_v<
|
||||||
T> || ((type::userdata == lua_type_of_v<T>)&&detail::has_internal_marker_v<lua_type_of<T>> && !detail::has_internal_marker_v<lua_size<T>>)
|
T> || ((type::userdata == lua_type_of_v<T>)&&detail::has_internal_marker_v<lua_type_of<T>> && !detail::has_internal_marker_v<lua_size<T>>)
|
||||||
|| is_lua_reference_or_proxy_v<T> || meta::is_specialization_of_v<T, std::tuple> || meta::is_specialization_of_v<T, std::pair>> {};
|
|| is_lua_reference_or_proxy_v<T> || meta::is_specialization_of_v<T, std::tuple> || meta::is_specialization_of_v<T, std::pair>> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
constexpr inline bool is_lua_primitive_v = is_lua_primitive<T>::value;
|
constexpr inline bool is_lua_primitive_v = is_lua_primitive<T>::value;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_main_threaded : std::is_base_of<main_reference, T> {};
|
struct is_main_threaded : std::is_base_of<main_reference, T> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_stack_based : std::is_base_of<stack_reference, T> {};
|
struct is_stack_based : std::is_base_of<stack_reference, T> { };
|
||||||
template <>
|
template <>
|
||||||
struct is_stack_based<variadic_args> : std::true_type {};
|
struct is_stack_based<variadic_args> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_stack_based<unsafe_function_result> : std::true_type {};
|
struct is_stack_based<unsafe_function_result> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_stack_based<protected_function_result> : std::true_type {};
|
struct is_stack_based<protected_function_result> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_stack_based<stack_proxy> : std::true_type {};
|
struct is_stack_based<stack_proxy> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_stack_based<stack_proxy_base> : std::true_type {};
|
struct is_stack_based<stack_proxy_base> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_stack_based<stack_count> : std::true_type {};
|
struct is_stack_based<stack_count> : std::true_type { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
constexpr inline bool is_stack_based_v = is_stack_based<T>::value;
|
constexpr inline bool is_stack_based_v = is_stack_based<T>::value;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_primitive<T*> : std::true_type {};
|
struct is_lua_primitive<T*> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_lua_primitive<unsafe_function_result> : std::true_type {};
|
struct is_lua_primitive<unsafe_function_result> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_lua_primitive<protected_function_result> : std::true_type {};
|
struct is_lua_primitive<protected_function_result> : std::true_type { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_primitive<std::reference_wrapper<T>> : std::true_type {};
|
struct is_lua_primitive<std::reference_wrapper<T>> : std::true_type { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_primitive<user<T>> : std::true_type {};
|
struct is_lua_primitive<user<T>> : std::true_type { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_primitive<light<T>> : is_lua_primitive<T*> {};
|
struct is_lua_primitive<light<T>> : is_lua_primitive<T*> { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_primitive<optional<T>> : std::true_type {};
|
struct is_lua_primitive<optional<T>> : std::true_type { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_primitive<std::optional<T>> : std::true_type {};
|
struct is_lua_primitive<std::optional<T>> : std::true_type { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_primitive<as_table_t<T>> : std::true_type {};
|
struct is_lua_primitive<as_table_t<T>> : std::true_type { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_primitive<nested<T>> : std::true_type {};
|
struct is_lua_primitive<nested<T>> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_lua_primitive<userdata_value> : std::true_type {};
|
struct is_lua_primitive<userdata_value> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_lua_primitive<lightuserdata_value> : std::true_type {};
|
struct is_lua_primitive<lightuserdata_value> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_lua_primitive<stack_proxy> : std::true_type {};
|
struct is_lua_primitive<stack_proxy> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_lua_primitive<stack_proxy_base> : std::true_type {};
|
struct is_lua_primitive<stack_proxy_base> : std::true_type { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_primitive<non_null<T>> : is_lua_primitive<T*> {};
|
struct is_lua_primitive<non_null<T>> : is_lua_primitive<T*> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_index : std::is_integral<T> {};
|
struct is_lua_index : std::is_integral<T> { };
|
||||||
template <>
|
template <>
|
||||||
struct is_lua_index<raw_index> : std::true_type {};
|
struct is_lua_index<raw_index> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_lua_index<absolute_index> : std::true_type {};
|
struct is_lua_index<absolute_index> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_lua_index<ref_index> : std::true_type {};
|
struct is_lua_index<ref_index> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_lua_index<upvalue_index> : std::true_type {};
|
struct is_lua_index<upvalue_index> : std::true_type { };
|
||||||
|
|
||||||
template <typename Signature>
|
template <typename Signature>
|
||||||
struct lua_bind_traits : meta::bind_traits<Signature> {
|
struct lua_bind_traits : meta::bind_traits<Signature> {
|
||||||
@ -1234,31 +1240,31 @@ namespace sol {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_table : std::false_type {};
|
struct is_table : std::false_type { };
|
||||||
template <bool x, typename T>
|
template <bool x, typename T>
|
||||||
struct is_table<basic_table_core<x, T>> : std::true_type {};
|
struct is_table<basic_table_core<x, T>> : std::true_type { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_table<basic_lua_table<T>> : std::true_type {};
|
struct is_table<basic_lua_table<T>> : std::true_type { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline constexpr bool is_table_v = is_table<T>::value;
|
inline constexpr bool is_table_v = is_table<T>::value;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_stack_table : std::false_type {};
|
struct is_stack_table : std::false_type { };
|
||||||
template <bool x, typename T>
|
template <bool x, typename T>
|
||||||
struct is_stack_table<basic_table_core<x, T>> : std::integral_constant<bool, std::is_base_of_v<stack_reference, T>> {};
|
struct is_stack_table<basic_table_core<x, T>> : std::integral_constant<bool, std::is_base_of_v<stack_reference, T>> { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_stack_table<basic_lua_table<T>> : std::integral_constant<bool, std::is_base_of_v<stack_reference, T>> {};
|
struct is_stack_table<basic_lua_table<T>> : std::integral_constant<bool, std::is_base_of_v<stack_reference, T>> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline constexpr bool is_stack_table_v = is_stack_table<T>::value;
|
inline constexpr bool is_stack_table_v = is_stack_table<T>::value;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_function : std::false_type {};
|
struct is_function : std::false_type { };
|
||||||
template <typename T, bool aligned>
|
template <typename T, bool aligned>
|
||||||
struct is_function<basic_function<T, aligned>> : std::true_type {};
|
struct is_function<basic_function<T, aligned>> : std::true_type { };
|
||||||
template <typename T, bool aligned, typename Handler>
|
template <typename T, bool aligned, typename Handler>
|
||||||
struct is_function<basic_protected_function<T, aligned, Handler>> : std::true_type {};
|
struct is_function<basic_protected_function<T, aligned, Handler>> : std::true_type { };
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -1300,31 +1306,31 @@ namespace sol {
|
|||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_non_factory_constructor : std::false_type {};
|
struct is_non_factory_constructor : std::false_type { };
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
struct is_non_factory_constructor<constructors<Args...>> : std::true_type {};
|
struct is_non_factory_constructor<constructors<Args...>> : std::true_type { };
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
struct is_non_factory_constructor<constructor_wrapper<Args...>> : std::true_type {};
|
struct is_non_factory_constructor<constructor_wrapper<Args...>> : std::true_type { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct is_non_factory_constructor<no_construction> : std::true_type {};
|
struct is_non_factory_constructor<no_construction> : std::true_type { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline constexpr bool is_non_factory_constructor_v = is_non_factory_constructor<T>::value;
|
inline constexpr bool is_non_factory_constructor_v = is_non_factory_constructor<T>::value;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_constructor : is_non_factory_constructor<T> {};
|
struct is_constructor : is_non_factory_constructor<T> { };
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
struct is_constructor<factory_wrapper<Args...>> : std::true_type {};
|
struct is_constructor<factory_wrapper<Args...>> : std::true_type { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_constructor<protect_t<T>> : is_constructor<meta::unqualified_t<T>> {};
|
struct is_constructor<protect_t<T>> : is_constructor<meta::unqualified_t<T>> { };
|
||||||
|
|
||||||
template <typename F, typename... Policies>
|
template <typename F, typename... Policies>
|
||||||
struct is_constructor<policy_wrapper<F, Policies...>> : is_constructor<meta::unqualified_t<F>> {};
|
struct is_constructor<policy_wrapper<F, Policies...>> : is_constructor<meta::unqualified_t<F>> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline constexpr bool is_constructor_v = is_constructor<T>::value;
|
inline constexpr bool is_constructor_v = is_constructor<T>::value;
|
||||||
@ -1336,10 +1342,10 @@ namespace sol {
|
|||||||
inline constexpr bool any_is_constructor_v = any_is_constructor<Args...>::value;
|
inline constexpr bool any_is_constructor_v = any_is_constructor<Args...>::value;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_destructor : std::false_type {};
|
struct is_destructor : std::false_type { };
|
||||||
|
|
||||||
template <typename Fx>
|
template <typename Fx>
|
||||||
struct is_destructor<destructor_wrapper<Fx>> : std::true_type {};
|
struct is_destructor<destructor_wrapper<Fx>> : std::true_type { };
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
using any_is_destructor = meta::any<is_destructor<meta::unqualified_t<Args>>...>;
|
using any_is_destructor = meta::any<is_destructor<meta::unqualified_t<Args>>...>;
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// This file was generated with a script.
|
// This file was generated with a script.
|
||||||
// Generated 2020-08-12 23:04:25.864654 UTC
|
// Generated 2020-09-05 21:23:26.771012 UTC
|
||||||
// This header was generated with sol v3.2.1 (revision 5bbc095)
|
// This header was generated with sol v3.2.1 (revision de87bec)
|
||||||
// https://github.com/ThePhD/sol2
|
// https://github.com/ThePhD/sol2
|
||||||
|
|
||||||
#ifndef SOL_SINGLE_CONFIG_HPP
|
#ifndef SOL_SINGLE_CONFIG_HPP
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// This file was generated with a script.
|
// This file was generated with a script.
|
||||||
// Generated 2020-08-12 23:04:25.839654 UTC
|
// Generated 2020-09-05 21:23:26.767014 UTC
|
||||||
// This header was generated with sol v3.2.1 (revision 5bbc095)
|
// This header was generated with sol v3.2.1 (revision de87bec)
|
||||||
// https://github.com/ThePhD/sol2
|
// https://github.com/ThePhD/sol2
|
||||||
|
|
||||||
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP
|
#ifndef SOL_SINGLE_INCLUDE_FORWARD_HPP
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// This file was generated with a script.
|
// This file was generated with a script.
|
||||||
// Generated 2020-08-12 23:04:25.317593 UTC
|
// Generated 2020-09-05 21:23:26.587015 UTC
|
||||||
// This header was generated with sol v3.2.1 (revision 5bbc095)
|
// This header was generated with sol v3.2.1 (revision de87bec)
|
||||||
// https://github.com/ThePhD/sol2
|
// https://github.com/ThePhD/sol2
|
||||||
|
|
||||||
#ifndef SOL_SINGLE_INCLUDE_HPP
|
#ifndef SOL_SINGLE_INCLUDE_HPP
|
||||||
@ -6486,7 +6486,7 @@ namespace sol {
|
|||||||
#endif // noexcept function type for lua_CFunction
|
#endif // noexcept function type for lua_CFunction
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct unique_usertype {};
|
struct unique_usertype { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct implicit_wrapper {
|
struct implicit_wrapper {
|
||||||
@ -6503,11 +6503,11 @@ namespace sol {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct yield_tag_t {};
|
struct yield_tag_t { };
|
||||||
const yield_tag_t yield_tag = yield_tag_t {};
|
const yield_tag_t yield_tag = yield_tag_t {};
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
struct lua_nil_t {};
|
struct lua_nil_t { };
|
||||||
inline constexpr lua_nil_t lua_nil {};
|
inline constexpr lua_nil_t lua_nil {};
|
||||||
inline bool operator==(lua_nil_t, lua_nil_t) {
|
inline bool operator==(lua_nil_t, lua_nil_t) {
|
||||||
return true;
|
return true;
|
||||||
@ -6521,16 +6521,16 @@ namespace sol {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
struct non_lua_nil_t {};
|
struct non_lua_nil_t { };
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
struct metatable_key_t {};
|
struct metatable_key_t { };
|
||||||
const metatable_key_t metatable_key = {};
|
const metatable_key_t metatable_key = {};
|
||||||
|
|
||||||
struct env_key_t {};
|
struct env_key_t { };
|
||||||
const env_key_t env_key = {};
|
const env_key_t env_key = {};
|
||||||
|
|
||||||
struct no_metatable_t {};
|
struct no_metatable_t { };
|
||||||
const no_metatable_t no_metatable = {};
|
const no_metatable_t no_metatable = {};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -6560,10 +6560,10 @@ namespace sol {
|
|||||||
typedef std::remove_pointer_t<lua_CFunction> lua_CFunction_ref;
|
typedef std::remove_pointer_t<lua_CFunction> lua_CFunction_ref;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct non_null {};
|
struct non_null { };
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
struct function_sig {};
|
struct function_sig { };
|
||||||
|
|
||||||
struct upvalue_index {
|
struct upvalue_index {
|
||||||
int index;
|
int index;
|
||||||
@ -6666,7 +6666,7 @@ namespace sol {
|
|||||||
operator std::add_lvalue_reference_t<U>() {
|
operator std::add_lvalue_reference_t<U>() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
operator std::add_const_t<std::add_lvalue_reference_t<U>>&() const {
|
operator std::add_const_t<std::add_lvalue_reference_t<U>> &() const {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -6808,7 +6808,7 @@ namespace sol {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nested_tag_t {};
|
struct nested_tag_t { };
|
||||||
constexpr inline nested_tag_t nested_tag {};
|
constexpr inline nested_tag_t nested_tag {};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -6939,11 +6939,11 @@ namespace sol {
|
|||||||
return push_invoke_t<Fx>(std::forward<Fx>(fx));
|
return push_invoke_t<Fx>(std::forward<Fx>(fx));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct override_value_t {};
|
struct override_value_t { };
|
||||||
constexpr inline override_value_t override_value = override_value_t();
|
constexpr inline override_value_t override_value = override_value_t();
|
||||||
struct update_if_empty_t {};
|
struct update_if_empty_t { };
|
||||||
constexpr inline update_if_empty_t update_if_empty = update_if_empty_t();
|
constexpr inline update_if_empty_t update_if_empty = update_if_empty_t();
|
||||||
struct create_if_nil_t {};
|
struct create_if_nil_t { };
|
||||||
constexpr inline create_if_nil_t create_if_nil = create_if_nil_t();
|
constexpr inline create_if_nil_t create_if_nil = create_if_nil_t();
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
@ -7079,6 +7079,12 @@ namespace sol {
|
|||||||
file = LUA_ERRFILE,
|
file = LUA_ERRFILE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class gc_mode : int {
|
||||||
|
incremental = 0,
|
||||||
|
generational = 1,
|
||||||
|
default = incremental,
|
||||||
|
};
|
||||||
|
|
||||||
enum class type : int {
|
enum class type : int {
|
||||||
none = LUA_TNONE,
|
none = LUA_TNONE,
|
||||||
lua_nil = LUA_TNIL,
|
lua_nil = LUA_TNIL,
|
||||||
@ -7281,33 +7287,33 @@ namespace sol {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_reference
|
struct is_lua_reference
|
||||||
: std::integral_constant<bool, std::is_base_of_v<reference, T> || std::is_base_of_v<main_reference, T> || std::is_base_of_v<stack_reference, T>> {};
|
: std::integral_constant<bool, std::is_base_of_v<reference, T> || std::is_base_of_v<main_reference, T> || std::is_base_of_v<stack_reference, T>> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline constexpr bool is_lua_reference_v = is_lua_reference<T>::value;
|
inline constexpr bool is_lua_reference_v = is_lua_reference<T>::value;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_reference_or_proxy : std::integral_constant<bool, is_lua_reference_v<T> || meta::is_specialization_of_v<T, table_proxy>> {};
|
struct is_lua_reference_or_proxy : std::integral_constant<bool, is_lua_reference_v<T> || meta::is_specialization_of_v<T, table_proxy>> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline constexpr bool is_lua_reference_or_proxy_v = is_lua_reference_or_proxy<T>::value;
|
inline constexpr bool is_lua_reference_or_proxy_v = is_lua_reference_or_proxy<T>::value;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_transparent_argument : std::false_type {};
|
struct is_transparent_argument : std::false_type { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
constexpr inline bool is_transparent_argument_v = is_transparent_argument<T>::value;
|
constexpr inline bool is_transparent_argument_v = is_transparent_argument<T>::value;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct is_transparent_argument<this_state> : std::true_type {};
|
struct is_transparent_argument<this_state> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_transparent_argument<this_main_state> : std::true_type {};
|
struct is_transparent_argument<this_main_state> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_transparent_argument<this_environment> : std::true_type {};
|
struct is_transparent_argument<this_environment> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_transparent_argument<variadic_args> : std::true_type {};
|
struct is_transparent_argument<variadic_args> : std::true_type { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_variadic_arguments : std::is_same<T, variadic_args> {};
|
struct is_variadic_arguments : std::is_same<T, variadic_args> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_container
|
struct is_container
|
||||||
@ -7321,221 +7327,221 @@ namespace sol {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_to_stringable : meta::any<meta::supports_to_string_member<meta::unqualified_t<T>>, meta::supports_adl_to_string<meta::unqualified_t<T>>,
|
struct is_to_stringable : meta::any<meta::supports_to_string_member<meta::unqualified_t<T>>, meta::supports_adl_to_string<meta::unqualified_t<T>>,
|
||||||
meta::supports_op_left_shift<std::ostream, meta::unqualified_t<T>>> {};
|
meta::supports_op_left_shift<std::ostream, meta::unqualified_t<T>>> { };
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template <typename T, typename = void>
|
template <typename T, typename = void>
|
||||||
struct lua_type_of : std::integral_constant<type, type::userdata> {};
|
struct lua_type_of : std::integral_constant<type, type::userdata> { };
|
||||||
|
|
||||||
template <typename C, typename T, typename A>
|
template <typename C, typename T, typename A>
|
||||||
struct lua_type_of<std::basic_string<C, T, A>> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<std::basic_string<C, T, A>> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <typename C, typename T>
|
template <typename C, typename T>
|
||||||
struct lua_type_of<basic_string_view<C, T>> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<basic_string_view<C, T>> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <std::size_t N>
|
template <std::size_t N>
|
||||||
struct lua_type_of<char[N]> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<char[N]> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <std::size_t N>
|
template <std::size_t N>
|
||||||
struct lua_type_of<wchar_t[N]> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<wchar_t[N]> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <std::size_t N>
|
template <std::size_t N>
|
||||||
struct lua_type_of<char16_t[N]> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<char16_t[N]> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <std::size_t N>
|
template <std::size_t N>
|
||||||
struct lua_type_of<char32_t[N]> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<char32_t[N]> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<char> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<char> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<wchar_t> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<wchar_t> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<char16_t> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<char16_t> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<char32_t> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<char32_t> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<const char*> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<const char*> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<const char16_t*> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<const char16_t*> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<const char32_t*> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<const char32_t*> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<bool> : std::integral_constant<type, type::boolean> {};
|
struct lua_type_of<bool> : std::integral_constant<type, type::boolean> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<lua_nil_t> : std::integral_constant<type, type::lua_nil> {};
|
struct lua_type_of<lua_nil_t> : std::integral_constant<type, type::lua_nil> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<nullopt_t> : std::integral_constant<type, type::lua_nil> {};
|
struct lua_type_of<nullopt_t> : std::integral_constant<type, type::lua_nil> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<lua_value> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<lua_value> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<detail::non_lua_nil_t> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<detail::non_lua_nil_t> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<std::nullptr_t> : std::integral_constant<type, type::lua_nil> {};
|
struct lua_type_of<std::nullptr_t> : std::integral_constant<type, type::lua_nil> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<error> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<error> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
template <bool b, typename Base>
|
template <bool b, typename Base>
|
||||||
struct lua_type_of<basic_table_core<b, Base>> : std::integral_constant<type, type::table> {};
|
struct lua_type_of<basic_table_core<b, Base>> : std::integral_constant<type, type::table> { };
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
struct lua_type_of<basic_lua_table<Base>> : std::integral_constant<type, type::table> {};
|
struct lua_type_of<basic_lua_table<Base>> : std::integral_constant<type, type::table> { };
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
struct lua_type_of<basic_metatable<Base>> : std::integral_constant<type, type::table> {};
|
struct lua_type_of<basic_metatable<Base>> : std::integral_constant<type, type::table> { };
|
||||||
|
|
||||||
template <typename T, typename Base>
|
template <typename T, typename Base>
|
||||||
struct lua_type_of<basic_usertype<T, Base>> : std::integral_constant<type, type::table> {};
|
struct lua_type_of<basic_usertype<T, Base>> : std::integral_constant<type, type::table> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<metatable_key_t> : std::integral_constant<type, type::table> {};
|
struct lua_type_of<metatable_key_t> : std::integral_constant<type, type::table> { };
|
||||||
|
|
||||||
template <typename B>
|
template <typename B>
|
||||||
struct lua_type_of<basic_environment<B>> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<basic_environment<B>> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<env_key_t> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<env_key_t> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<new_table> : std::integral_constant<type, type::table> {};
|
struct lua_type_of<new_table> : std::integral_constant<type, type::table> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct lua_type_of<as_table_t<T>> : std::integral_constant<type, type::table> {};
|
struct lua_type_of<as_table_t<T>> : std::integral_constant<type, type::table> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct lua_type_of<std::initializer_list<T>> : std::integral_constant<type, type::table> {};
|
struct lua_type_of<std::initializer_list<T>> : std::integral_constant<type, type::table> { };
|
||||||
|
|
||||||
template <bool b>
|
template <bool b>
|
||||||
struct lua_type_of<basic_reference<b>> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<basic_reference<b>> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<stack_reference> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<stack_reference> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
struct lua_type_of<basic_object<Base>> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<basic_object<Base>> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
struct lua_type_of<std::tuple<Args...>> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<std::tuple<Args...>> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <typename A, typename B>
|
template <typename A, typename B>
|
||||||
struct lua_type_of<std::pair<A, B>> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<std::pair<A, B>> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<void*> : std::integral_constant<type, type::lightuserdata> {};
|
struct lua_type_of<void*> : std::integral_constant<type, type::lightuserdata> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<const void*> : std::integral_constant<type, type::lightuserdata> {};
|
struct lua_type_of<const void*> : std::integral_constant<type, type::lightuserdata> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<lightuserdata_value> : std::integral_constant<type, type::lightuserdata> {};
|
struct lua_type_of<lightuserdata_value> : std::integral_constant<type, type::lightuserdata> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<userdata_value> : std::integral_constant<type, type::userdata> {};
|
struct lua_type_of<userdata_value> : std::integral_constant<type, type::userdata> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct lua_type_of<light<T>> : std::integral_constant<type, type::lightuserdata> {};
|
struct lua_type_of<light<T>> : std::integral_constant<type, type::lightuserdata> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct lua_type_of<user<T>> : std::integral_constant<type, type::userdata> {};
|
struct lua_type_of<user<T>> : std::integral_constant<type, type::userdata> { };
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
struct lua_type_of<basic_lightuserdata<Base>> : std::integral_constant<type, type::lightuserdata> {};
|
struct lua_type_of<basic_lightuserdata<Base>> : std::integral_constant<type, type::lightuserdata> { };
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
struct lua_type_of<basic_userdata<Base>> : std::integral_constant<type, type::userdata> {};
|
struct lua_type_of<basic_userdata<Base>> : std::integral_constant<type, type::userdata> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<lua_CFunction> : std::integral_constant<type, type::function> {};
|
struct lua_type_of<lua_CFunction> : std::integral_constant<type, type::function> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<std::remove_pointer_t<lua_CFunction>> : std::integral_constant<type, type::function> {};
|
struct lua_type_of<std::remove_pointer_t<lua_CFunction>> : std::integral_constant<type, type::function> { };
|
||||||
|
|
||||||
template <typename Base, bool aligned>
|
template <typename Base, bool aligned>
|
||||||
struct lua_type_of<basic_function<Base, aligned>> : std::integral_constant<type, type::function> {};
|
struct lua_type_of<basic_function<Base, aligned>> : std::integral_constant<type, type::function> { };
|
||||||
|
|
||||||
template <typename Base, bool aligned, typename Handler>
|
template <typename Base, bool aligned, typename Handler>
|
||||||
struct lua_type_of<basic_protected_function<Base, aligned, Handler>> : std::integral_constant<type, type::function> {};
|
struct lua_type_of<basic_protected_function<Base, aligned, Handler>> : std::integral_constant<type, type::function> { };
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
struct lua_type_of<basic_coroutine<Base>> : std::integral_constant<type, type::function> {};
|
struct lua_type_of<basic_coroutine<Base>> : std::integral_constant<type, type::function> { };
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
struct lua_type_of<basic_thread<Base>> : std::integral_constant<type, type::thread> {};
|
struct lua_type_of<basic_thread<Base>> : std::integral_constant<type, type::thread> { };
|
||||||
|
|
||||||
template <typename Signature>
|
template <typename Signature>
|
||||||
struct lua_type_of<std::function<Signature>> : std::integral_constant<type, type::function> {};
|
struct lua_type_of<std::function<Signature>> : std::integral_constant<type, type::function> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct lua_type_of<optional<T>> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<optional<T>> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct lua_type_of<std::optional<T>> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<std::optional<T>> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<variadic_args> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<variadic_args> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<variadic_results> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<variadic_results> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<stack_count> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<stack_count> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<this_state> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<this_state> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<this_main_state> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<this_main_state> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<this_environment> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<this_environment> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<type> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<type> : std::integral_constant<type, type::poly> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct lua_type_of<T*> : std::integral_constant<type, type::userdata> {};
|
struct lua_type_of<T*> : std::integral_constant<type, type::userdata> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct lua_type_of<T, std::enable_if_t<std::is_arithmetic_v<T> || std::is_same_v<T, lua_Number> || std::is_same_v<T, lua_Integer>>>
|
struct lua_type_of<T, std::enable_if_t<std::is_arithmetic_v<T> || std::is_same_v<T, lua_Number> || std::is_same_v<T, lua_Integer>>>
|
||||||
: std::integral_constant<type, type::number> {};
|
: std::integral_constant<type, type::number> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct lua_type_of<T, std::enable_if_t<std::is_enum_v<T>>> : std::integral_constant<type, type::number> {};
|
struct lua_type_of<T, std::enable_if_t<std::is_enum_v<T>>> : std::integral_constant<type, type::number> { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct lua_type_of<meta_function> : std::integral_constant<type, type::string> {};
|
struct lua_type_of<meta_function> : std::integral_constant<type, type::string> { };
|
||||||
|
|
||||||
#if SOL_IS_ON(SOL_STD_VARIANT_I_)
|
#if SOL_IS_ON(SOL_STD_VARIANT_I_)
|
||||||
template <typename... Tn>
|
template <typename... Tn>
|
||||||
struct lua_type_of<std::variant<Tn...>> : std::integral_constant<type, type::poly> {};
|
struct lua_type_of<std::variant<Tn...>> : std::integral_constant<type, type::poly> { };
|
||||||
#endif // std::variant deployment sucks on Clang
|
#endif // std::variant deployment sucks on Clang
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct lua_type_of<nested<T>> : meta::conditional_t<::sol::is_container_v<T>, std::integral_constant<type, type::table>, lua_type_of<T>> {};
|
struct lua_type_of<nested<T>> : meta::conditional_t<::sol::is_container_v<T>, std::integral_constant<type, type::table>, lua_type_of<T>> { };
|
||||||
|
|
||||||
template <typename C, C v, template <typename...> class V, typename... Args>
|
template <typename C, C v, template <typename...> class V, typename... Args>
|
||||||
struct accumulate : std::integral_constant<C, v> {};
|
struct accumulate : std::integral_constant<C, v> { };
|
||||||
|
|
||||||
template <typename C, C v, template <typename...> class V, typename T, typename... Args>
|
template <typename C, C v, template <typename...> class V, typename T, typename... Args>
|
||||||
struct accumulate<C, v, V, T, Args...> : accumulate<C, v + V<T>::value, V, Args...> {};
|
struct accumulate<C, v, V, T, Args...> : accumulate<C, v + V<T>::value, V, Args...> { };
|
||||||
|
|
||||||
template <typename C, C v, template <typename...> class V, typename List>
|
template <typename C, C v, template <typename...> class V, typename List>
|
||||||
struct accumulate_list;
|
struct accumulate_list;
|
||||||
|
|
||||||
template <typename C, C v, template <typename...> class V, typename... Args>
|
template <typename C, C v, template <typename...> class V, typename... Args>
|
||||||
struct accumulate_list<C, v, V, types<Args...>> : accumulate<C, v, V, Args...> {};
|
struct accumulate_list<C, v, V, types<Args...>> : accumulate<C, v, V, Args...> { };
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -7552,10 +7558,10 @@ namespace sol {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename A, typename B>
|
template <typename A, typename B>
|
||||||
struct lua_size<std::pair<A, B>> : std::integral_constant<int, lua_size<A>::value + lua_size<B>::value> {};
|
struct lua_size<std::pair<A, B>> : std::integral_constant<int, lua_size<A>::value + lua_size<B>::value> { };
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
struct lua_size<std::tuple<Args...>> : std::integral_constant<int, detail::accumulate<int, 0, lua_size, Args...>::value> {};
|
struct lua_size<std::tuple<Args...>> : std::integral_constant<int, detail::accumulate<int, 0, lua_size, Args...>::value> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline constexpr int lua_size_v = lua_size<T>::value;
|
inline constexpr int lua_size_v = lua_size<T>::value;
|
||||||
@ -7566,9 +7572,9 @@ namespace sol {
|
|||||||
typedef void type;
|
typedef void type;
|
||||||
};
|
};
|
||||||
template <typename T, typename = void>
|
template <typename T, typename = void>
|
||||||
struct has_internal_marker_impl : std::false_type {};
|
struct has_internal_marker_impl : std::false_type { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct has_internal_marker_impl<T, typename void_<typename T::SOL_INTERNAL_UNSPECIALIZED_MARKER_>::type> : std::true_type {};
|
struct has_internal_marker_impl<T, typename void_<typename T::SOL_INTERNAL_UNSPECIALIZED_MARKER_>::type> : std::true_type { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
using has_internal_marker = has_internal_marker_impl<T>;
|
using has_internal_marker = has_internal_marker_impl<T>;
|
||||||
@ -7583,73 +7589,73 @@ namespace sol {
|
|||||||
type::userdata
|
type::userdata
|
||||||
!= lua_type_of_v<
|
!= lua_type_of_v<
|
||||||
T> || ((type::userdata == lua_type_of_v<T>)&&detail::has_internal_marker_v<lua_type_of<T>> && !detail::has_internal_marker_v<lua_size<T>>)
|
T> || ((type::userdata == lua_type_of_v<T>)&&detail::has_internal_marker_v<lua_type_of<T>> && !detail::has_internal_marker_v<lua_size<T>>)
|
||||||
|| is_lua_reference_or_proxy_v<T> || meta::is_specialization_of_v<T, std::tuple> || meta::is_specialization_of_v<T, std::pair>> {};
|
|| is_lua_reference_or_proxy_v<T> || meta::is_specialization_of_v<T, std::tuple> || meta::is_specialization_of_v<T, std::pair>> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
constexpr inline bool is_lua_primitive_v = is_lua_primitive<T>::value;
|
constexpr inline bool is_lua_primitive_v = is_lua_primitive<T>::value;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_main_threaded : std::is_base_of<main_reference, T> {};
|
struct is_main_threaded : std::is_base_of<main_reference, T> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_stack_based : std::is_base_of<stack_reference, T> {};
|
struct is_stack_based : std::is_base_of<stack_reference, T> { };
|
||||||
template <>
|
template <>
|
||||||
struct is_stack_based<variadic_args> : std::true_type {};
|
struct is_stack_based<variadic_args> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_stack_based<unsafe_function_result> : std::true_type {};
|
struct is_stack_based<unsafe_function_result> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_stack_based<protected_function_result> : std::true_type {};
|
struct is_stack_based<protected_function_result> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_stack_based<stack_proxy> : std::true_type {};
|
struct is_stack_based<stack_proxy> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_stack_based<stack_proxy_base> : std::true_type {};
|
struct is_stack_based<stack_proxy_base> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_stack_based<stack_count> : std::true_type {};
|
struct is_stack_based<stack_count> : std::true_type { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
constexpr inline bool is_stack_based_v = is_stack_based<T>::value;
|
constexpr inline bool is_stack_based_v = is_stack_based<T>::value;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_primitive<T*> : std::true_type {};
|
struct is_lua_primitive<T*> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_lua_primitive<unsafe_function_result> : std::true_type {};
|
struct is_lua_primitive<unsafe_function_result> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_lua_primitive<protected_function_result> : std::true_type {};
|
struct is_lua_primitive<protected_function_result> : std::true_type { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_primitive<std::reference_wrapper<T>> : std::true_type {};
|
struct is_lua_primitive<std::reference_wrapper<T>> : std::true_type { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_primitive<user<T>> : std::true_type {};
|
struct is_lua_primitive<user<T>> : std::true_type { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_primitive<light<T>> : is_lua_primitive<T*> {};
|
struct is_lua_primitive<light<T>> : is_lua_primitive<T*> { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_primitive<optional<T>> : std::true_type {};
|
struct is_lua_primitive<optional<T>> : std::true_type { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_primitive<std::optional<T>> : std::true_type {};
|
struct is_lua_primitive<std::optional<T>> : std::true_type { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_primitive<as_table_t<T>> : std::true_type {};
|
struct is_lua_primitive<as_table_t<T>> : std::true_type { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_primitive<nested<T>> : std::true_type {};
|
struct is_lua_primitive<nested<T>> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_lua_primitive<userdata_value> : std::true_type {};
|
struct is_lua_primitive<userdata_value> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_lua_primitive<lightuserdata_value> : std::true_type {};
|
struct is_lua_primitive<lightuserdata_value> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_lua_primitive<stack_proxy> : std::true_type {};
|
struct is_lua_primitive<stack_proxy> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_lua_primitive<stack_proxy_base> : std::true_type {};
|
struct is_lua_primitive<stack_proxy_base> : std::true_type { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_primitive<non_null<T>> : is_lua_primitive<T*> {};
|
struct is_lua_primitive<non_null<T>> : is_lua_primitive<T*> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_lua_index : std::is_integral<T> {};
|
struct is_lua_index : std::is_integral<T> { };
|
||||||
template <>
|
template <>
|
||||||
struct is_lua_index<raw_index> : std::true_type {};
|
struct is_lua_index<raw_index> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_lua_index<absolute_index> : std::true_type {};
|
struct is_lua_index<absolute_index> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_lua_index<ref_index> : std::true_type {};
|
struct is_lua_index<ref_index> : std::true_type { };
|
||||||
template <>
|
template <>
|
||||||
struct is_lua_index<upvalue_index> : std::true_type {};
|
struct is_lua_index<upvalue_index> : std::true_type { };
|
||||||
|
|
||||||
template <typename Signature>
|
template <typename Signature>
|
||||||
struct lua_bind_traits : meta::bind_traits<Signature> {
|
struct lua_bind_traits : meta::bind_traits<Signature> {
|
||||||
@ -7667,31 +7673,31 @@ namespace sol {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_table : std::false_type {};
|
struct is_table : std::false_type { };
|
||||||
template <bool x, typename T>
|
template <bool x, typename T>
|
||||||
struct is_table<basic_table_core<x, T>> : std::true_type {};
|
struct is_table<basic_table_core<x, T>> : std::true_type { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_table<basic_lua_table<T>> : std::true_type {};
|
struct is_table<basic_lua_table<T>> : std::true_type { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline constexpr bool is_table_v = is_table<T>::value;
|
inline constexpr bool is_table_v = is_table<T>::value;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_stack_table : std::false_type {};
|
struct is_stack_table : std::false_type { };
|
||||||
template <bool x, typename T>
|
template <bool x, typename T>
|
||||||
struct is_stack_table<basic_table_core<x, T>> : std::integral_constant<bool, std::is_base_of_v<stack_reference, T>> {};
|
struct is_stack_table<basic_table_core<x, T>> : std::integral_constant<bool, std::is_base_of_v<stack_reference, T>> { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_stack_table<basic_lua_table<T>> : std::integral_constant<bool, std::is_base_of_v<stack_reference, T>> {};
|
struct is_stack_table<basic_lua_table<T>> : std::integral_constant<bool, std::is_base_of_v<stack_reference, T>> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline constexpr bool is_stack_table_v = is_stack_table<T>::value;
|
inline constexpr bool is_stack_table_v = is_stack_table<T>::value;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_function : std::false_type {};
|
struct is_function : std::false_type { };
|
||||||
template <typename T, bool aligned>
|
template <typename T, bool aligned>
|
||||||
struct is_function<basic_function<T, aligned>> : std::true_type {};
|
struct is_function<basic_function<T, aligned>> : std::true_type { };
|
||||||
template <typename T, bool aligned, typename Handler>
|
template <typename T, bool aligned, typename Handler>
|
||||||
struct is_function<basic_protected_function<T, aligned, Handler>> : std::true_type {};
|
struct is_function<basic_protected_function<T, aligned, Handler>> : std::true_type { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
using is_lightuserdata = meta::is_specialization_of<T, basic_lightuserdata>;
|
using is_lightuserdata = meta::is_specialization_of<T, basic_lightuserdata>;
|
||||||
@ -7732,31 +7738,31 @@ namespace sol {
|
|||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_non_factory_constructor : std::false_type {};
|
struct is_non_factory_constructor : std::false_type { };
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
struct is_non_factory_constructor<constructors<Args...>> : std::true_type {};
|
struct is_non_factory_constructor<constructors<Args...>> : std::true_type { };
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
struct is_non_factory_constructor<constructor_wrapper<Args...>> : std::true_type {};
|
struct is_non_factory_constructor<constructor_wrapper<Args...>> : std::true_type { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct is_non_factory_constructor<no_construction> : std::true_type {};
|
struct is_non_factory_constructor<no_construction> : std::true_type { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline constexpr bool is_non_factory_constructor_v = is_non_factory_constructor<T>::value;
|
inline constexpr bool is_non_factory_constructor_v = is_non_factory_constructor<T>::value;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_constructor : is_non_factory_constructor<T> {};
|
struct is_constructor : is_non_factory_constructor<T> { };
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
struct is_constructor<factory_wrapper<Args...>> : std::true_type {};
|
struct is_constructor<factory_wrapper<Args...>> : std::true_type { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_constructor<protect_t<T>> : is_constructor<meta::unqualified_t<T>> {};
|
struct is_constructor<protect_t<T>> : is_constructor<meta::unqualified_t<T>> { };
|
||||||
|
|
||||||
template <typename F, typename... Policies>
|
template <typename F, typename... Policies>
|
||||||
struct is_constructor<policy_wrapper<F, Policies...>> : is_constructor<meta::unqualified_t<F>> {};
|
struct is_constructor<policy_wrapper<F, Policies...>> : is_constructor<meta::unqualified_t<F>> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline constexpr bool is_constructor_v = is_constructor<T>::value;
|
inline constexpr bool is_constructor_v = is_constructor<T>::value;
|
||||||
@ -7768,10 +7774,10 @@ namespace sol {
|
|||||||
inline constexpr bool any_is_constructor_v = any_is_constructor<Args...>::value;
|
inline constexpr bool any_is_constructor_v = any_is_constructor<Args...>::value;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_destructor : std::false_type {};
|
struct is_destructor : std::false_type { };
|
||||||
|
|
||||||
template <typename Fx>
|
template <typename Fx>
|
||||||
struct is_destructor<destructor_wrapper<Fx>> : std::true_type {};
|
struct is_destructor<destructor_wrapper<Fx>> : std::true_type { };
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
using any_is_destructor = meta::any<is_destructor<meta::unqualified_t<Args>>...>;
|
using any_is_destructor = meta::any<is_destructor<meta::unqualified_t<Args>>...>;
|
||||||
@ -9676,16 +9682,16 @@ namespace sol {
|
|||||||
|
|
||||||
namespace sol {
|
namespace sol {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
struct with_function_tag {};
|
struct with_function_tag { };
|
||||||
struct as_reference_tag {};
|
struct as_reference_tag { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct as_pointer_tag {};
|
struct as_pointer_tag { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct as_value_tag {};
|
struct as_value_tag { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct as_unique_tag {};
|
struct as_unique_tag { };
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct as_table_tag {};
|
struct as_table_tag { };
|
||||||
|
|
||||||
using lua_reg_table = luaL_Reg[64];
|
using lua_reg_table = luaL_Reg[64];
|
||||||
|
|
||||||
@ -9722,7 +9728,11 @@ namespace sol {
|
|||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
std::size_t aligned_space_for(void* alignment = nullptr) {
|
std::size_t aligned_space_for(void* alignment = nullptr) {
|
||||||
char* start = static_cast<char*>(alignment);
|
// use temporary storage to prevent strict UB shenanigans
|
||||||
|
using union_type = std::aligned_union<1, Args...>;
|
||||||
|
using union_type_t = typename union_type::type;
|
||||||
|
char alignment_shim[(std::max)({ sizeof(Args)... }) + (std::max)({ alignof(Args)... })] {};
|
||||||
|
char* start = alignment == nullptr ? static_cast<char*>(alignment) : alignment_shim;
|
||||||
(void)detail::swallow { int {}, (align_one(std::alignment_of_v<Args>, sizeof(Args), alignment), int {})... };
|
(void)detail::swallow { int {}, (align_one(std::alignment_of_v<Args>, sizeof(Args), alignment), int {})... };
|
||||||
return static_cast<char*>(alignment) - start;
|
return static_cast<char*>(alignment) - start;
|
||||||
}
|
}
|
||||||
@ -11052,24 +11062,24 @@ namespace sol {
|
|||||||
void insert_default_registrations(IFx&& ifx, Fx&& fx);
|
void insert_default_registrations(IFx&& ifx, Fx&& fx);
|
||||||
|
|
||||||
template <typename T, bool, bool>
|
template <typename T, bool, bool>
|
||||||
struct get_is_primitive : is_lua_primitive<T> {};
|
struct get_is_primitive : is_lua_primitive<T> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct get_is_primitive<T, true, false>
|
struct get_is_primitive<T, true, false>
|
||||||
: meta::neg<std::is_reference<decltype(sol_lua_get(types<T>(), nullptr, -1, std::declval<stack::record&>()))>> {};
|
: meta::neg<std::is_reference<decltype(sol_lua_get(types<T>(), nullptr, -1, std::declval<stack::record&>()))>> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct get_is_primitive<T, false, true>
|
struct get_is_primitive<T, false, true>
|
||||||
: meta::neg<std::is_reference<decltype(sol_lua_get(types<meta::unqualified_t<T>>(), nullptr, -1, std::declval<stack::record&>()))>> {};
|
: meta::neg<std::is_reference<decltype(sol_lua_get(types<meta::unqualified_t<T>>(), nullptr, -1, std::declval<stack::record&>()))>> { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct get_is_primitive<T, true, true> : get_is_primitive<T, true, false> {};
|
struct get_is_primitive<T, true, true> : get_is_primitive<T, true, false> { };
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct is_proxy_primitive
|
struct is_proxy_primitive
|
||||||
: detail::get_is_primitive<T, meta::meta_detail::is_adl_sol_lua_get_v<T>, meta::meta_detail::is_adl_sol_lua_get_v<meta::unqualified_t<T>>> {};
|
: detail::get_is_primitive<T, meta::meta_detail::is_adl_sol_lua_get_v<T>, meta::meta_detail::is_adl_sol_lua_get_v<meta::unqualified_t<T>>> { };
|
||||||
|
|
||||||
} // namespace sol
|
} // namespace sol
|
||||||
|
|
||||||
@ -17455,14 +17465,19 @@ namespace sol {
|
|||||||
|
|
||||||
// beginning of sol/function_types_stateless.hpp
|
// beginning of sol/function_types_stateless.hpp
|
||||||
|
|
||||||
namespace sol {
|
namespace sol { namespace function_detail {
|
||||||
namespace function_detail {
|
|
||||||
template <typename Function, bool is_yielding>
|
template <typename Function, bool is_yielding>
|
||||||
struct upvalue_free_function {
|
struct upvalue_free_function {
|
||||||
using function_type = std::remove_pointer_t<std::decay_t<Function>>;
|
using function_type = std::remove_pointer_t<std::decay_t<Function>>;
|
||||||
using traits_type = meta::bind_traits<function_type>;
|
using traits_type = meta::bind_traits<function_type>;
|
||||||
|
|
||||||
static int real_call(lua_State* L) noexcept(traits_type::is_noexcept) {
|
static int real_call(lua_State* L)
|
||||||
|
#if SOL_IS_ON(SOL_COMPILER_VCXX_I_)
|
||||||
|
// MSVC is broken, what a surprise...
|
||||||
|
#else
|
||||||
|
noexcept(traits_type::is_noexcept)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
auto udata = stack::stack_detail::get_as_upvalues<function_type*>(L);
|
auto udata = stack::stack_detail::get_as_upvalues<function_type*>(L);
|
||||||
function_type* fx = udata.first;
|
function_type* fx = udata.first;
|
||||||
return call_detail::call_wrapped<void, true, false>(L, fx);
|
return call_detail::call_wrapped<void, true, false>(L, fx);
|
||||||
@ -17488,7 +17503,13 @@ namespace function_detail {
|
|||||||
typedef std::remove_pointer_t<std::decay_t<Function>> function_type;
|
typedef std::remove_pointer_t<std::decay_t<Function>> function_type;
|
||||||
typedef lua_bind_traits<function_type> traits_type;
|
typedef lua_bind_traits<function_type> traits_type;
|
||||||
|
|
||||||
static int real_call(lua_State* L) noexcept(traits_type::is_noexcept) {
|
static int real_call(lua_State* L)
|
||||||
|
#if SOL_IS_ON(SOL_COMPILER_VCXX_I_)
|
||||||
|
// MSVC is broken, what a surprise...
|
||||||
|
#else
|
||||||
|
noexcept(traits_type::is_noexcept)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
// Layout:
|
// Layout:
|
||||||
// idx 1...n: verbatim data of member function pointer
|
// idx 1...n: verbatim data of member function pointer
|
||||||
// idx n + 1: is the object's void pointer
|
// idx n + 1: is the object's void pointer
|
||||||
@ -17499,7 +17520,13 @@ namespace function_detail {
|
|||||||
return call_detail::call_wrapped<T, true, false, -1>(L, memfx, item);
|
return call_detail::call_wrapped<T, true, false, -1>(L, memfx, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int call(lua_State* L) noexcept(traits_type::is_noexcept) {
|
static int call(lua_State* L)
|
||||||
|
#if SOL_IS_ON(SOL_COMPILER_VCXX_I_)
|
||||||
|
// MSVC is broken, what a surprise...
|
||||||
|
#else
|
||||||
|
noexcept(traits_type::is_noexcept)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
int nr = detail::typed_static_trampoline<decltype(&real_call), (&real_call)>(L);
|
int nr = detail::typed_static_trampoline<decltype(&real_call), (&real_call)>(L);
|
||||||
if (is_yielding) {
|
if (is_yielding) {
|
||||||
return lua_yield(L, nr);
|
return lua_yield(L, nr);
|
||||||
@ -17519,7 +17546,13 @@ namespace function_detail {
|
|||||||
typedef std::remove_pointer_t<std::decay_t<Function>> function_type;
|
typedef std::remove_pointer_t<std::decay_t<Function>> function_type;
|
||||||
typedef lua_bind_traits<function_type> traits_type;
|
typedef lua_bind_traits<function_type> traits_type;
|
||||||
|
|
||||||
static int real_call(lua_State* L) noexcept(traits_type::is_noexcept) {
|
static int real_call(lua_State* L)
|
||||||
|
#if SOL_IS_ON(SOL_COMPILER_VCXX_I_)
|
||||||
|
// MSVC is broken, what a surprise...
|
||||||
|
#else
|
||||||
|
noexcept(traits_type::is_noexcept)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
// Layout:
|
// Layout:
|
||||||
// idx 1...n: verbatim data of member variable pointer
|
// idx 1...n: verbatim data of member variable pointer
|
||||||
// idx n + 1: is the object's void pointer
|
// idx n + 1: is the object's void pointer
|
||||||
@ -17539,7 +17572,13 @@ namespace function_detail {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int call(lua_State* L) noexcept(traits_type::is_noexcept) {
|
static int call(lua_State* L)
|
||||||
|
#if SOL_IS_ON(SOL_COMPILER_VCXX_I_)
|
||||||
|
// MSVC is broken, what a surprise...
|
||||||
|
#else
|
||||||
|
noexcept(traits_type::is_noexcept)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
int nr = detail::typed_static_trampoline<decltype(&real_call), (&real_call)>(L);
|
int nr = detail::typed_static_trampoline<decltype(&real_call), (&real_call)>(L);
|
||||||
if (is_yielding) {
|
if (is_yielding) {
|
||||||
return lua_yield(L, nr);
|
return lua_yield(L, nr);
|
||||||
@ -17559,7 +17598,13 @@ namespace function_detail {
|
|||||||
typedef std::remove_pointer_t<std::decay_t<Function>> function_type;
|
typedef std::remove_pointer_t<std::decay_t<Function>> function_type;
|
||||||
typedef lua_bind_traits<function_type> traits_type;
|
typedef lua_bind_traits<function_type> traits_type;
|
||||||
|
|
||||||
static int real_call(lua_State* L) noexcept(traits_type::is_noexcept) {
|
static int real_call(lua_State* L)
|
||||||
|
#if SOL_IS_ON(SOL_COMPILER_VCXX_I_)
|
||||||
|
// MSVC is broken, what a surprise...
|
||||||
|
#else
|
||||||
|
noexcept(traits_type::is_noexcept)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
// Layout:
|
// Layout:
|
||||||
// idx 1...n: verbatim data of member variable pointer
|
// idx 1...n: verbatim data of member variable pointer
|
||||||
// idx n + 1: is the object's void pointer
|
// idx n + 1: is the object's void pointer
|
||||||
@ -17577,7 +17622,13 @@ namespace function_detail {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int call(lua_State* L) {
|
static int call(lua_State* L)
|
||||||
|
#if SOL_IS_ON(SOL_COMPILER_VCXX_I_)
|
||||||
|
// MSVC is broken, what a surprise...
|
||||||
|
#else
|
||||||
|
noexcept(traits_type::is_noexcept)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
int nr = detail::typed_static_trampoline<decltype(&real_call), (&real_call)>(L);
|
int nr = detail::typed_static_trampoline<decltype(&real_call), (&real_call)>(L);
|
||||||
if (is_yielding) {
|
if (is_yielding) {
|
||||||
return lua_yield(L, nr);
|
return lua_yield(L, nr);
|
||||||
@ -17597,14 +17648,26 @@ namespace function_detail {
|
|||||||
typedef std::remove_pointer_t<std::decay_t<Function>> function_type;
|
typedef std::remove_pointer_t<std::decay_t<Function>> function_type;
|
||||||
typedef lua_bind_traits<function_type> traits_type;
|
typedef lua_bind_traits<function_type> traits_type;
|
||||||
|
|
||||||
static int real_call(lua_State* L) noexcept(traits_type::is_noexcept) {
|
static int real_call(lua_State* L)
|
||||||
|
#if SOL_IS_ON(SOL_COMPILER_VCXX_I_)
|
||||||
|
// MSVC is broken, what a surprise...
|
||||||
|
#else
|
||||||
|
noexcept(traits_type::is_noexcept)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
// Layout:
|
// Layout:
|
||||||
// idx 1...n: verbatim data of member variable pointer
|
// idx 1...n: verbatim data of member variable pointer
|
||||||
function_type& memfx = stack::get<user<function_type>>(L, upvalue_index(2));
|
function_type& memfx = stack::get<user<function_type>>(L, upvalue_index(2));
|
||||||
return call_detail::call_wrapped<T, false, false>(L, memfx);
|
return call_detail::call_wrapped<T, false, false>(L, memfx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int call(lua_State* L) {
|
static int call(lua_State* L)
|
||||||
|
#if SOL_IS_ON(SOL_COMPILER_VCXX_I_)
|
||||||
|
// MSVC is broken, what a surprise...
|
||||||
|
#else
|
||||||
|
noexcept(traits_type::is_noexcept)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
int nr = detail::typed_static_trampoline<decltype(&real_call), (&real_call)>(L);
|
int nr = detail::typed_static_trampoline<decltype(&real_call), (&real_call)>(L);
|
||||||
if (is_yielding) {
|
if (is_yielding) {
|
||||||
return lua_yield(L, nr);
|
return lua_yield(L, nr);
|
||||||
@ -17685,8 +17748,7 @@ namespace function_detail {
|
|||||||
return call(L);
|
return call(L);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}} // namespace sol::function_detail
|
||||||
} // namespace sol::function_detail
|
|
||||||
|
|
||||||
// end of sol/function_types_stateless.hpp
|
// end of sol/function_types_stateless.hpp
|
||||||
|
|
||||||
@ -25366,10 +25428,88 @@ namespace sol {
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool supports_gc_mode(gc_mode mode) const noexcept {
|
||||||
|
#if SOL_LUA_VERSION >= 504
|
||||||
|
// supports all modes
|
||||||
|
(void)mode;
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
|
return mode == gc_mode::default;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool is_gc_on() const {
|
||||||
|
return lua_gc(lua_state(), LUA_GCISRUNNING, 0) == 1;
|
||||||
|
}
|
||||||
|
|
||||||
void collect_garbage() {
|
void collect_garbage() {
|
||||||
lua_gc(lua_state(), LUA_GCCOLLECT, 0);
|
lua_gc(lua_state(), LUA_GCCOLLECT, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void collect_gc() {
|
||||||
|
collect_garbage();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool step_gc(int step_size_kilobytes) {
|
||||||
|
// THOUGHT: std::chrono-alikes to map "kilobyte size" here...?
|
||||||
|
// Make it harder to give MB or KB to a B parameter...?
|
||||||
|
// Probably overkill for now.
|
||||||
|
#if SOL_LUA_VERSION >= 504
|
||||||
|
// The manual implies that this function is almost always successful...
|
||||||
|
// is it?? It could depend on the GC mode...
|
||||||
|
return lua_gc(lua_state(), LUA_GCSTEP, step_size_kilobytes) != 0;
|
||||||
|
#else
|
||||||
|
return lua_gc(lua_state(), LUA_GCSTEP, step_size_kilobytes) == 1;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void restart_gc() {
|
||||||
|
lua_gc(lua_state(), LUA_GCRESTART, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void stop_gc() {
|
||||||
|
lua_gc(lua_state(), LUA_GCSTOP, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the old GC mode. Check support using the supports_gc_mode function.
|
||||||
|
gc_mode change_gc_mode_incremental(int pause, int step_multiplier, int step_byte_size) {
|
||||||
|
// "What the fuck does any of this mean??"
|
||||||
|
// http://www.lua.org/manual/5.4/manual.html#2.5.1
|
||||||
|
|
||||||
|
// THOUGHT: std::chrono-alikes to map "byte size" here...?
|
||||||
|
// Make it harder to give MB or KB to a B parameter...?
|
||||||
|
// Probably overkill for now.
|
||||||
|
#if SOL_LUA_VERSION >= 504
|
||||||
|
int old_mode = lua_gc(lua_state(), LUA_GCINC, pause, step_multiplier, step_byte_size);
|
||||||
|
if (old_mode == LUA_GCGEN) {
|
||||||
|
return gc_mode::generational;
|
||||||
|
}
|
||||||
|
else if (old_mode == LUA_GCINC) {
|
||||||
|
return gc_mode::incremental;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
lua_gc(lua_state(), LUA_GCSETPAUSE, pause);
|
||||||
|
lua_gc(lua_state(), LUA_GCSETSTEPMUL, step_multiplier);
|
||||||
|
(void)step_byte_size; // means nothing in older versions
|
||||||
|
#endif
|
||||||
|
return gc_mode::default;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns the old GC mode. Check support using the supports_gc_mode function.
|
||||||
|
gc_mode change_gc_mode_generational(int minor_multiplier, int major_multiplier) {
|
||||||
|
#if SOL_LUA_VERSION >= 504
|
||||||
|
// "What does this shit mean?"
|
||||||
|
// http://www.lua.org/manual/5.4/manual.html#2.5.2
|
||||||
|
int old_mode = lua_gc(lua_state(), LUA_GCGEN, minor_multiplier, major_multiplier);
|
||||||
|
if (old_mode == LUA_GCGEN) {
|
||||||
|
return gc_mode::generational;
|
||||||
|
}
|
||||||
|
else if (old_mode == LUA_GCINC) {
|
||||||
|
return gc_mode::incremental;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return gc_mode::default;
|
||||||
|
}
|
||||||
|
|
||||||
operator lua_State*() const {
|
operator lua_State*() const {
|
||||||
return lua_state();
|
return lua_state();
|
||||||
}
|
}
|
||||||
@ -26275,7 +26415,8 @@ namespace sol {
|
|||||||
using base_t = std::vector<object, Al>;
|
using base_t = std::vector<object, Al>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
basic_variadic_results() : base_t() {}
|
basic_variadic_results() : base_t() {
|
||||||
|
}
|
||||||
|
|
||||||
basic_variadic_results(unsafe_function_result fr) : base_t() {
|
basic_variadic_results(unsafe_function_result fr) : base_t() {
|
||||||
this->reserve(fr.return_count());
|
this->reserve(fr.return_count());
|
||||||
@ -26306,10 +26447,10 @@ namespace sol {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename Al>
|
template <typename Al>
|
||||||
struct is_container<basic_variadic_results<Al>> : std::false_type {};
|
struct is_container<basic_variadic_results<Al>> : std::false_type { };
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct is_container<variadic_results> : std::false_type {};
|
struct is_container<variadic_results> : std::false_type { };
|
||||||
|
|
||||||
namespace stack {
|
namespace stack {
|
||||||
template <typename Al>
|
template <typename Al>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user