mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
-Wshadow and -Wconversion are kind've dumb
This commit is contained in:
parent
49a0f71272
commit
289ded358c
|
@ -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 2016-11-23 07:55:07.806043 UTC
|
// Generated 2016-11-26 01:46:59.897910 UTC
|
||||||
// This header was generated with sol v2.15.1 (revision ed21ba7)
|
// This header was generated with sol v2.15.2 (revision 49a0f71)
|
||||||
// https://github.com/ThePhD/sol2
|
// https://github.com/ThePhD/sol2
|
||||||
|
|
||||||
#ifndef SOL_SINGLE_INCLUDE_HPP
|
#ifndef SOL_SINGLE_INCLUDE_HPP
|
||||||
|
@ -1904,19 +1904,24 @@ namespace sol {
|
||||||
# define OPTIONAL_CONSTEXPR_INIT_LIST
|
# define OPTIONAL_CONSTEXPR_INIT_LIST
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if defined TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_ && (defined __cplusplus) && (__cplusplus != 201103L)
|
# if defined(TR2_OPTIONAL_MSVC_2015_AND_HIGHER___) || (defined TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_ && (defined __cplusplus) && (__cplusplus != 201103L))
|
||||||
# define OPTIONAL_HAS_MOVE_ACCESSORS 1
|
# define OPTIONAL_HAS_MOVE_ACCESSORS 1
|
||||||
# else
|
# else
|
||||||
# define OPTIONAL_HAS_MOVE_ACCESSORS 0
|
# define OPTIONAL_HAS_MOVE_ACCESSORS 0
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# // In C++11 constexpr implies const, so we need to make non-const members also non-constexpr
|
# // In C++11 constexpr implies const, so we need to make non-const members also non-constexpr
|
||||||
# if (defined __cplusplus) && (__cplusplus == 201103L)
|
# if defined(TR2_OPTIONAL_MSVC_2015_AND_HIGHER___) || ((defined __cplusplus) && (__cplusplus == 201103L))
|
||||||
# define OPTIONAL_MUTABLE_CONSTEXPR
|
# define OPTIONAL_MUTABLE_CONSTEXPR
|
||||||
# else
|
# else
|
||||||
# define OPTIONAL_MUTABLE_CONSTEXPR constexpr
|
# define OPTIONAL_MUTABLE_CONSTEXPR constexpr
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# if defined TR2_OPTIONAL_MSVC_2015_AND_HIGHER___
|
||||||
|
#pragma warning( push )
|
||||||
|
#pragma warning( disable : 4814 )
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace sol {
|
namespace sol {
|
||||||
|
|
||||||
// BEGIN workaround for missing is_trivially_destructible
|
// BEGIN workaround for missing is_trivially_destructible
|
||||||
|
@ -2885,6 +2890,10 @@ namespace std
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# if defined TR2_OPTIONAL_MSVC_2015_AND_HIGHER___
|
||||||
|
#pragma warning( pop )
|
||||||
|
#endif
|
||||||
|
|
||||||
# undef TR2_OPTIONAL_REQUIRES
|
# undef TR2_OPTIONAL_REQUIRES
|
||||||
# undef TR2_OPTIONAL_ASSERTED_EXPRESSION
|
# undef TR2_OPTIONAL_ASSERTED_EXPRESSION
|
||||||
|
|
||||||
|
@ -2917,8 +2926,8 @@ namespace sol {
|
||||||
const char* p;
|
const char* p;
|
||||||
|
|
||||||
string_shim(const std::string& r) : string_shim(r.data(), r.size()) {}
|
string_shim(const std::string& r) : string_shim(r.data(), r.size()) {}
|
||||||
string_shim(const char* p) : string_shim(p, std::char_traits<char>::length(p)) {}
|
string_shim(const char* ptr) : string_shim(ptr, std::char_traits<char>::length(ptr)) {}
|
||||||
string_shim(const char* p, std::size_t s) : s(s), p(p) {}
|
string_shim(const char* ptr, std::size_t sz) : s(sz), p(ptr) {}
|
||||||
|
|
||||||
static int compare(const char* lhs_p, std::size_t lhs_sz, const char* rhs_p, std::size_t rhs_sz) {
|
static int compare(const char* lhs_p, std::size_t lhs_sz, const char* rhs_p, std::size_t rhs_sz) {
|
||||||
int result = std::char_traits<char>::compare(lhs_p, rhs_p, lhs_sz < rhs_sz ? lhs_sz : rhs_sz);
|
int result = std::char_traits<char>::compare(lhs_p, rhs_p, lhs_sz < rhs_sz ? lhs_sz : rhs_sz);
|
||||||
|
@ -3195,14 +3204,14 @@ namespace sol {
|
||||||
struct closure {
|
struct closure {
|
||||||
lua_CFunction c_function;
|
lua_CFunction c_function;
|
||||||
std::tuple<Upvalues...> upvalues;
|
std::tuple<Upvalues...> upvalues;
|
||||||
closure(lua_CFunction f, Upvalues... upvalues) : c_function(f), upvalues(std::forward<Upvalues>(upvalues)...) {}
|
closure(lua_CFunction f, Upvalues... targetupvalues) : c_function(f), upvalues(std::forward<Upvalues>(targetupvalues)...) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct closure<> {
|
struct closure<> {
|
||||||
lua_CFunction c_function;
|
lua_CFunction c_function;
|
||||||
int upvalues;
|
int upvalues;
|
||||||
closure(lua_CFunction f, int upvalues = 0) : c_function(f), upvalues(upvalues) {}
|
closure(lua_CFunction f, int upvalue_count = 0) : c_function(f), upvalues(upvalue_count) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef closure<> c_closure;
|
typedef closure<> c_closure;
|
||||||
|
@ -3787,7 +3796,7 @@ namespace sol {
|
||||||
struct push_popper_n {
|
struct push_popper_n {
|
||||||
lua_State* L;
|
lua_State* L;
|
||||||
int t;
|
int t;
|
||||||
push_popper_n(lua_State* L, int x) : L(L), t(x) { }
|
push_popper_n(lua_State* luastate, int x) : L(luastate), t(x) { }
|
||||||
~push_popper_n() { lua_pop(L, t); }
|
~push_popper_n() { lua_pop(L, t); }
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
|
@ -3821,20 +3830,20 @@ namespace sol {
|
||||||
|
|
||||||
class reference {
|
class reference {
|
||||||
private:
|
private:
|
||||||
lua_State* L = nullptr; // non-owning
|
lua_State* luastate = nullptr; // non-owning
|
||||||
int ref = LUA_NOREF;
|
int ref = LUA_NOREF;
|
||||||
|
|
||||||
int copy() const noexcept {
|
int copy() const noexcept {
|
||||||
if (ref == LUA_NOREF)
|
if (ref == LUA_NOREF)
|
||||||
return LUA_NOREF;
|
return LUA_NOREF;
|
||||||
push();
|
push();
|
||||||
return luaL_ref(L, LUA_REGISTRYINDEX);
|
return luaL_ref(lua_state(), LUA_REGISTRYINDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
reference(lua_State* L, detail::global_tag) noexcept : L(L) {
|
reference(lua_State* L, detail::global_tag) noexcept : luastate(L) {
|
||||||
lua_pushglobaltable(L);
|
lua_pushglobaltable(lua_state());
|
||||||
ref = luaL_ref(L, LUA_REGISTRYINDEX);
|
ref = luaL_ref(lua_state(), LUA_REGISTRYINDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
int stack_index() const noexcept {
|
int stack_index() const noexcept {
|
||||||
|
@ -3846,46 +3855,46 @@ namespace sol {
|
||||||
reference(nil_t) noexcept : reference() {}
|
reference(nil_t) noexcept : reference() {}
|
||||||
reference(const stack_reference& r) noexcept : reference(r.lua_state(), r.stack_index()) {}
|
reference(const stack_reference& r) noexcept : reference(r.lua_state(), r.stack_index()) {}
|
||||||
reference(stack_reference&& r) noexcept : reference(r.lua_state(), r.stack_index()) {}
|
reference(stack_reference&& r) noexcept : reference(r.lua_state(), r.stack_index()) {}
|
||||||
reference(lua_State* L, int index = -1) noexcept : L(L) {
|
reference(lua_State* L, int index = -1) noexcept : luastate(L) {
|
||||||
lua_pushvalue(L, index);
|
lua_pushvalue(lua_state(), index);
|
||||||
ref = luaL_ref(L, LUA_REGISTRYINDEX);
|
ref = luaL_ref(lua_state(), LUA_REGISTRYINDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~reference() noexcept {
|
virtual ~reference() noexcept {
|
||||||
luaL_unref(L, LUA_REGISTRYINDEX, ref);
|
luaL_unref(lua_state(), LUA_REGISTRYINDEX, ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
reference(reference&& o) noexcept {
|
reference(reference&& o) noexcept {
|
||||||
L = o.L;
|
luastate = o.luastate;
|
||||||
ref = o.ref;
|
ref = o.ref;
|
||||||
|
|
||||||
o.L = nullptr;
|
o.luastate = nullptr;
|
||||||
o.ref = LUA_NOREF;
|
o.ref = LUA_NOREF;
|
||||||
}
|
}
|
||||||
|
|
||||||
reference& operator=(reference&& o) noexcept {
|
reference& operator=(reference&& o) noexcept {
|
||||||
L = o.L;
|
luastate = o.luastate;
|
||||||
ref = o.ref;
|
ref = o.ref;
|
||||||
|
|
||||||
o.L = nullptr;
|
o.luastate = nullptr;
|
||||||
o.ref = LUA_NOREF;
|
o.ref = LUA_NOREF;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
reference(const reference& o) noexcept {
|
reference(const reference& o) noexcept {
|
||||||
L = o.L;
|
luastate = o.luastate;
|
||||||
ref = o.copy();
|
ref = o.copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
reference& operator=(const reference& o) noexcept {
|
reference& operator=(const reference& o) noexcept {
|
||||||
L = o.L;
|
luastate = o.luastate;
|
||||||
ref = o.copy();
|
ref = o.copy();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
int push() const noexcept {
|
int push() const noexcept {
|
||||||
lua_rawgeti(L, LUA_REGISTRYINDEX, ref);
|
lua_rawgeti(lua_state(), LUA_REGISTRYINDEX, ref);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3907,12 +3916,12 @@ namespace sol {
|
||||||
|
|
||||||
type get_type() const noexcept {
|
type get_type() const noexcept {
|
||||||
auto pp = stack::push_pop(*this);
|
auto pp = stack::push_pop(*this);
|
||||||
int result = lua_type(L, -1);
|
int result = lua_type(lua_state(), -1);
|
||||||
return static_cast<type>(result);
|
return static_cast<type>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
lua_State* lua_state() const noexcept {
|
lua_State* lua_state() const noexcept {
|
||||||
return L;
|
return luastate;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4335,7 +4344,7 @@ namespace sol {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline auto tagged_get(types<T>, lua_State* L, int index, record& tracking) -> decltype(stack_detail::unchecked_get<T>(L, index, tracking)) {
|
inline auto tagged_get(types<T>, lua_State* L, int index, record& tracking) -> decltype(stack_detail::unchecked_get<T>(L, index, tracking)) {
|
||||||
auto op = check_get<T>(L, index, type_panic, tracking);
|
auto op = check_get<T>(L, index, type_panic, tracking);
|
||||||
return *op;
|
return *std::move(op);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -7077,7 +7086,7 @@ namespace sol {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
function_result() = default;
|
function_result() = default;
|
||||||
function_result(lua_State* L, int index = -1, int returncount = 0) : L(L), index(index), returncount(returncount) {
|
function_result(lua_State* Ls, int idx = -1, int retnum = 0) : L(Ls), index(idx), returncount(retnum) {
|
||||||
|
|
||||||
}
|
}
|
||||||
function_result(const function_result&) = default;
|
function_result(const function_result&) = default;
|
||||||
|
@ -7493,7 +7502,7 @@ namespace sol {
|
||||||
struct constructor_match {
|
struct constructor_match {
|
||||||
T* obj;
|
T* obj;
|
||||||
|
|
||||||
constructor_match(T* obj) : obj(obj) {}
|
constructor_match(T* o) : obj(o) {}
|
||||||
|
|
||||||
template <typename Fx, std::size_t I, typename... R, typename... Args>
|
template <typename Fx, std::size_t I, typename... R, typename... Args>
|
||||||
int operator()(types<Fx>, index_value<I>, types<R...> r, types<Args...> a, lua_State* L, int, int start) const {
|
int operator()(types<Fx>, index_value<I>, types<R...> r, types<Args...> a, lua_State* L, int, int start) const {
|
||||||
|
@ -8319,7 +8328,7 @@ namespace sol {
|
||||||
}
|
}
|
||||||
|
|
||||||
int operator()(lua_State* L) {
|
int operator()(lua_State* L) {
|
||||||
auto f = [&](lua_State* L) -> int { return this->call(L); };
|
auto f = [&](lua_State*) -> int { return this->call(L); };
|
||||||
return detail::trampoline(L, f);
|
return detail::trampoline(L, f);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -8340,7 +8349,7 @@ namespace sol {
|
||||||
}
|
}
|
||||||
|
|
||||||
int operator()(lua_State* L) {
|
int operator()(lua_State* L) {
|
||||||
auto f = [&](lua_State* L) -> int { return this->call(L); };
|
auto f = [&](lua_State*) -> int { return this->call(L); };
|
||||||
return detail::trampoline(L, f);
|
return detail::trampoline(L, f);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -8370,7 +8379,7 @@ namespace sol {
|
||||||
}
|
}
|
||||||
|
|
||||||
int operator()(lua_State* L) {
|
int operator()(lua_State* L) {
|
||||||
auto f = [&](lua_State* L) -> int { return this->call(L); };
|
auto f = [&](lua_State*) -> int { return this->call(L); };
|
||||||
return detail::trampoline(L, f);
|
return detail::trampoline(L, f);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -9035,7 +9044,7 @@ namespace sol {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
protected_function_result() = default;
|
protected_function_result() = default;
|
||||||
protected_function_result(lua_State* L, int index = -1, int returncount = 0, int popcount = 0, call_status err = call_status::ok) noexcept : L(L), index(index), returncount(returncount), popcount(popcount), err(err) {
|
protected_function_result(lua_State* Ls, int idx = -1, int retnum = 0, int popped = 0, call_status pferr = call_status::ok) noexcept : L(Ls), index(idx), returncount(retnum), popcount(popped), err(pferr) {
|
||||||
|
|
||||||
}
|
}
|
||||||
protected_function_result(const protected_function_result&) = default;
|
protected_function_result(const protected_function_result&) = default;
|
||||||
|
@ -9368,7 +9377,7 @@ namespace sol {
|
||||||
stack_proxy sp;
|
stack_proxy sp;
|
||||||
|
|
||||||
va_iterator() : L(nullptr), index((std::numeric_limits<int>::max)()), stacktop((std::numeric_limits<int>::max)()) {}
|
va_iterator() : L(nullptr), index((std::numeric_limits<int>::max)()), stacktop((std::numeric_limits<int>::max)()) {}
|
||||||
va_iterator(lua_State* L, int index, int stacktop) : L(L), index(index), stacktop(stacktop), sp(L, index) {}
|
va_iterator(lua_State* luastate, int idx, int topidx) : L(luastate), index(idx), stacktop(topidx), sp(luastate, idx) {}
|
||||||
|
|
||||||
reference operator*() {
|
reference operator*() {
|
||||||
return stack_proxy(L, index);
|
return stack_proxy(L, index);
|
||||||
|
@ -9479,7 +9488,7 @@ namespace sol {
|
||||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||||
|
|
||||||
variadic_args() = default;
|
variadic_args() = default;
|
||||||
variadic_args(lua_State* L, int index = -1) : L(L), index(lua_absindex(L, index)), stacktop(lua_gettop(L)) {}
|
variadic_args(lua_State* luastate, int stackindex = -1) : L(luastate), index(lua_absindex(luastate, stackindex)), stacktop(lua_gettop(luastate)) {}
|
||||||
variadic_args(const variadic_args&) = default;
|
variadic_args(const variadic_args&) = default;
|
||||||
variadic_args& operator=(const variadic_args&) = default;
|
variadic_args& operator=(const variadic_args&) = default;
|
||||||
variadic_args(variadic_args&& o) : L(o.L), index(o.index), stacktop(o.stacktop) {
|
variadic_args(variadic_args&& o) : L(o.L), index(o.index), stacktop(o.stacktop) {
|
||||||
|
@ -9705,7 +9714,7 @@ namespace sol {
|
||||||
key_type key;
|
key_type key;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
proxy(Table table, T&& key) : tbl(table), key(std::forward<T>(key)) {}
|
proxy(Table table, T&& k) : tbl(table), key(std::forward<T>(k)) {}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
proxy& set(T&& item) {
|
proxy& set(T&& item) {
|
||||||
|
@ -11618,8 +11627,8 @@ namespace sol {
|
||||||
namespace sol {
|
namespace sol {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template <std::size_t n>
|
template <std::size_t n>
|
||||||
struct clean { lua_State* L; clean(lua_State* L) : L(L) {} ~clean() { lua_pop(L, static_cast<int>(n)); } };
|
struct clean { lua_State* L; clean(lua_State* luastate) : L(luastate) {} ~clean() { lua_pop(L, static_cast<int>(n)); } };
|
||||||
struct ref_clean { lua_State* L; int& n; ref_clean(lua_State* L, int& n) : L(L), n(n) {} ~ref_clean() { lua_pop(L, static_cast<int>(n)); } };
|
struct ref_clean { lua_State* L; int& n; ref_clean(lua_State* luastate, int& n) : L(luastate), n(n) {} ~ref_clean() { lua_pop(L, static_cast<int>(n)); } };
|
||||||
inline int fail_on_newindex(lua_State* L) {
|
inline int fail_on_newindex(lua_State* L) {
|
||||||
return luaL_error(L, "sol: cannot modify the elements of an enumeration table");
|
return luaL_error(L, "sol: cannot modify the elements of an enumeration table");
|
||||||
}
|
}
|
||||||
|
@ -12044,6 +12053,10 @@ namespace sol {
|
||||||
static const int narr = static_cast<int>(meta::count_2_for_pack<std::is_integral, Args...>::value);
|
static const int narr = static_cast<int>(meta::count_2_for_pack<std::is_integral, Args...>::value);
|
||||||
return create(std::forward<Name>(name), narr, sizeof...(Args) / 2 - narr, std::forward<Args>(args)...);
|
return create(std::forward<Name>(name), narr, sizeof...(Args) / 2 - narr, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~basic_table_core() {
|
||||||
|
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // sol
|
} // sol
|
||||||
|
|
||||||
|
@ -12102,7 +12115,7 @@ namespace sol {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
load_result() = default;
|
load_result() = default;
|
||||||
load_result(lua_State* L, int index = -1, int returncount = 0, int popcount = 0, load_status err = load_status::ok) noexcept : L(L), index(index), returncount(returncount), popcount(popcount), err(err) {
|
load_result(lua_State* Ls, int stackindex = -1, int retnum = 0, int popnum = 0, load_status lerr = load_status::ok) noexcept : L(Ls), index(stackindex), returncount(retnum), popcount(popnum), err(lerr) {
|
||||||
|
|
||||||
}
|
}
|
||||||
load_result(const load_result&) = default;
|
load_result(const load_result&) = default;
|
||||||
|
@ -12249,14 +12262,14 @@ namespace sol {
|
||||||
typedef global_table::iterator iterator;
|
typedef global_table::iterator iterator;
|
||||||
typedef global_table::const_iterator const_iterator;
|
typedef global_table::const_iterator const_iterator;
|
||||||
|
|
||||||
state_view(lua_State* L) :
|
state_view(lua_State* Ls) :
|
||||||
L(L),
|
L(Ls),
|
||||||
reg(L, LUA_REGISTRYINDEX),
|
reg(Ls, LUA_REGISTRYINDEX),
|
||||||
global(L, detail::global_) {
|
global(Ls, detail::global_) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
state_view(this_state L) : state_view(L.L){
|
state_view(this_state Ls) : state_view(Ls.L){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
sol.hpp
10
sol.hpp
|
@ -33,6 +33,12 @@
|
||||||
#endif
|
#endif
|
||||||
#endif // Unreal Engine 4 Bullshit
|
#endif // Unreal Engine 4 Bullshit
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wshadow"
|
||||||
|
#pragma GCC diagnostic ignored "-Wconversion"
|
||||||
|
#endif // g++
|
||||||
|
|
||||||
#include "sol/state.hpp"
|
#include "sol/state.hpp"
|
||||||
#include "sol/object.hpp"
|
#include "sol/object.hpp"
|
||||||
#include "sol/function.hpp"
|
#include "sol/function.hpp"
|
||||||
|
@ -41,6 +47,10 @@
|
||||||
#include "sol/coroutine.hpp"
|
#include "sol/coroutine.hpp"
|
||||||
#include "sol/variadic_args.hpp"
|
#include "sol/variadic_args.hpp"
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif // g++
|
||||||
|
|
||||||
#ifdef SOL_INSIDE_UNREAL
|
#ifdef SOL_INSIDE_UNREAL
|
||||||
#ifdef SOL_INSIDE_UNREAL_REMOVED_CHECK
|
#ifdef SOL_INSIDE_UNREAL_REMOVED_CHECK
|
||||||
#define check(expr) { if(UNLIKELY(!(expr))) { FDebug::LogAssertFailedMessage( #expr, __FILE__, __LINE__ ); _DebugBreakAndPromptForRemote(); FDebug::AssertFailed( #expr, __FILE__, __LINE__ ); CA_ASSUME(false); } }}
|
#define check(expr) { if(UNLIKELY(!(expr))) { FDebug::LogAssertFailedMessage( #expr, __FILE__, __LINE__ ); _DebugBreakAndPromptForRemote(); FDebug::AssertFailed( #expr, __FILE__, __LINE__ ); CA_ASSUME(false); } }}
|
||||||
|
|
|
@ -52,7 +52,7 @@ namespace sol {
|
||||||
struct constructor_match {
|
struct constructor_match {
|
||||||
T* obj;
|
T* obj;
|
||||||
|
|
||||||
constructor_match(T* obj) : obj(obj) {}
|
constructor_match(T* o) : obj(o) {}
|
||||||
|
|
||||||
template <typename Fx, std::size_t I, typename... R, typename... Args>
|
template <typename Fx, std::size_t I, typename... R, typename... Args>
|
||||||
int operator()(types<Fx>, index_value<I>, types<R...> r, types<Args...> a, lua_State* L, int, int start) const {
|
int operator()(types<Fx>, index_value<I>, types<R...> r, types<Args...> a, lua_State* L, int, int start) const {
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace sol {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
function_result() = default;
|
function_result() = default;
|
||||||
function_result(lua_State* L, int index = -1, int returncount = 0) : L(L), index(index), returncount(returncount) {
|
function_result(lua_State* Ls, int idx = -1, int retnum = 0) : L(Ls), index(idx), returncount(retnum) {
|
||||||
|
|
||||||
}
|
}
|
||||||
function_result(const function_result&) = default;
|
function_result(const function_result&) = default;
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace sol {
|
||||||
}
|
}
|
||||||
|
|
||||||
int operator()(lua_State* L) {
|
int operator()(lua_State* L) {
|
||||||
auto f = [&](lua_State* L) -> int { return this->call(L); };
|
auto f = [&](lua_State*) -> int { return this->call(L); };
|
||||||
return detail::trampoline(L, f);
|
return detail::trampoline(L, f);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -60,7 +60,7 @@ namespace sol {
|
||||||
}
|
}
|
||||||
|
|
||||||
int operator()(lua_State* L) {
|
int operator()(lua_State* L) {
|
||||||
auto f = [&](lua_State* L) -> int { return this->call(L); };
|
auto f = [&](lua_State*) -> int { return this->call(L); };
|
||||||
return detail::trampoline(L, f);
|
return detail::trampoline(L, f);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -90,7 +90,7 @@ namespace sol {
|
||||||
}
|
}
|
||||||
|
|
||||||
int operator()(lua_State* L) {
|
int operator()(lua_State* L) {
|
||||||
auto f = [&](lua_State* L) -> int { return this->call(L); };
|
auto f = [&](lua_State*) -> int { return this->call(L); };
|
||||||
return detail::trampoline(L, f);
|
return detail::trampoline(L, f);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace sol {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
load_result() = default;
|
load_result() = default;
|
||||||
load_result(lua_State* L, int index = -1, int returncount = 0, int popcount = 0, load_status err = load_status::ok) noexcept : L(L), index(index), returncount(returncount), popcount(popcount), err(err) {
|
load_result(lua_State* Ls, int stackindex = -1, int retnum = 0, int popnum = 0, load_status lerr = load_status::ok) noexcept : L(Ls), index(stackindex), returncount(retnum), popcount(popnum), err(lerr) {
|
||||||
|
|
||||||
}
|
}
|
||||||
load_result(const load_result&) = default;
|
load_result(const load_result&) = default;
|
||||||
|
|
|
@ -110,19 +110,24 @@
|
||||||
# define OPTIONAL_CONSTEXPR_INIT_LIST
|
# define OPTIONAL_CONSTEXPR_INIT_LIST
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if defined TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_ && (defined __cplusplus) && (__cplusplus != 201103L)
|
# if defined(TR2_OPTIONAL_MSVC_2015_AND_HIGHER___) || (defined TR2_OPTIONAL_CLANG_3_5_AND_HIGHTER_ && (defined __cplusplus) && (__cplusplus != 201103L))
|
||||||
# define OPTIONAL_HAS_MOVE_ACCESSORS 1
|
# define OPTIONAL_HAS_MOVE_ACCESSORS 1
|
||||||
# else
|
# else
|
||||||
# define OPTIONAL_HAS_MOVE_ACCESSORS 0
|
# define OPTIONAL_HAS_MOVE_ACCESSORS 0
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# // In C++11 constexpr implies const, so we need to make non-const members also non-constexpr
|
# // In C++11 constexpr implies const, so we need to make non-const members also non-constexpr
|
||||||
# if (defined __cplusplus) && (__cplusplus == 201103L)
|
# if defined(TR2_OPTIONAL_MSVC_2015_AND_HIGHER___) || ((defined __cplusplus) && (__cplusplus == 201103L))
|
||||||
# define OPTIONAL_MUTABLE_CONSTEXPR
|
# define OPTIONAL_MUTABLE_CONSTEXPR
|
||||||
# else
|
# else
|
||||||
# define OPTIONAL_MUTABLE_CONSTEXPR constexpr
|
# define OPTIONAL_MUTABLE_CONSTEXPR constexpr
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# if defined TR2_OPTIONAL_MSVC_2015_AND_HIGHER___
|
||||||
|
#pragma warning( push )
|
||||||
|
#pragma warning( disable : 4814 )
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace sol {
|
namespace sol {
|
||||||
|
|
||||||
// BEGIN workaround for missing is_trivially_destructible
|
// BEGIN workaround for missing is_trivially_destructible
|
||||||
|
@ -1121,6 +1126,11 @@ namespace std
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# if defined TR2_OPTIONAL_MSVC_2015_AND_HIGHER___
|
||||||
|
#pragma warning( pop )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
# undef TR2_OPTIONAL_REQUIRES
|
# undef TR2_OPTIONAL_REQUIRES
|
||||||
# undef TR2_OPTIONAL_ASSERTED_EXPRESSION
|
# undef TR2_OPTIONAL_ASSERTED_EXPRESSION
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace sol {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
protected_function_result() = default;
|
protected_function_result() = default;
|
||||||
protected_function_result(lua_State* L, int index = -1, int returncount = 0, int popcount = 0, call_status err = call_status::ok) noexcept : L(L), index(index), returncount(returncount), popcount(popcount), err(err) {
|
protected_function_result(lua_State* Ls, int idx = -1, int retnum = 0, int popped = 0, call_status pferr = call_status::ok) noexcept : L(Ls), index(idx), returncount(retnum), popcount(popped), err(pferr) {
|
||||||
|
|
||||||
}
|
}
|
||||||
protected_function_result(const protected_function_result&) = default;
|
protected_function_result(const protected_function_result&) = default;
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace sol {
|
||||||
key_type key;
|
key_type key;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
proxy(Table table, T&& key) : tbl(table), key(std::forward<T>(key)) {}
|
proxy(Table table, T&& k) : tbl(table), key(std::forward<T>(k)) {}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
proxy& set(T&& item) {
|
proxy& set(T&& item) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace sol {
|
||||||
struct push_popper_n {
|
struct push_popper_n {
|
||||||
lua_State* L;
|
lua_State* L;
|
||||||
int t;
|
int t;
|
||||||
push_popper_n(lua_State* L, int x) : L(L), t(x) { }
|
push_popper_n(lua_State* luastate, int x) : L(luastate), t(x) { }
|
||||||
~push_popper_n() { lua_pop(L, t); }
|
~push_popper_n() { lua_pop(L, t); }
|
||||||
};
|
};
|
||||||
template <>
|
template <>
|
||||||
|
@ -65,20 +65,20 @@ namespace sol {
|
||||||
|
|
||||||
class reference {
|
class reference {
|
||||||
private:
|
private:
|
||||||
lua_State* L = nullptr; // non-owning
|
lua_State* luastate = nullptr; // non-owning
|
||||||
int ref = LUA_NOREF;
|
int ref = LUA_NOREF;
|
||||||
|
|
||||||
int copy() const noexcept {
|
int copy() const noexcept {
|
||||||
if (ref == LUA_NOREF)
|
if (ref == LUA_NOREF)
|
||||||
return LUA_NOREF;
|
return LUA_NOREF;
|
||||||
push();
|
push();
|
||||||
return luaL_ref(L, LUA_REGISTRYINDEX);
|
return luaL_ref(lua_state(), LUA_REGISTRYINDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
reference(lua_State* L, detail::global_tag) noexcept : L(L) {
|
reference(lua_State* L, detail::global_tag) noexcept : luastate(L) {
|
||||||
lua_pushglobaltable(L);
|
lua_pushglobaltable(lua_state());
|
||||||
ref = luaL_ref(L, LUA_REGISTRYINDEX);
|
ref = luaL_ref(lua_state(), LUA_REGISTRYINDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
int stack_index() const noexcept {
|
int stack_index() const noexcept {
|
||||||
|
@ -90,46 +90,46 @@ namespace sol {
|
||||||
reference(nil_t) noexcept : reference() {}
|
reference(nil_t) noexcept : reference() {}
|
||||||
reference(const stack_reference& r) noexcept : reference(r.lua_state(), r.stack_index()) {}
|
reference(const stack_reference& r) noexcept : reference(r.lua_state(), r.stack_index()) {}
|
||||||
reference(stack_reference&& r) noexcept : reference(r.lua_state(), r.stack_index()) {}
|
reference(stack_reference&& r) noexcept : reference(r.lua_state(), r.stack_index()) {}
|
||||||
reference(lua_State* L, int index = -1) noexcept : L(L) {
|
reference(lua_State* L, int index = -1) noexcept : luastate(L) {
|
||||||
lua_pushvalue(L, index);
|
lua_pushvalue(lua_state(), index);
|
||||||
ref = luaL_ref(L, LUA_REGISTRYINDEX);
|
ref = luaL_ref(lua_state(), LUA_REGISTRYINDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~reference() noexcept {
|
virtual ~reference() noexcept {
|
||||||
luaL_unref(L, LUA_REGISTRYINDEX, ref);
|
luaL_unref(lua_state(), LUA_REGISTRYINDEX, ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
reference(reference&& o) noexcept {
|
reference(reference&& o) noexcept {
|
||||||
L = o.L;
|
luastate = o.luastate;
|
||||||
ref = o.ref;
|
ref = o.ref;
|
||||||
|
|
||||||
o.L = nullptr;
|
o.luastate = nullptr;
|
||||||
o.ref = LUA_NOREF;
|
o.ref = LUA_NOREF;
|
||||||
}
|
}
|
||||||
|
|
||||||
reference& operator=(reference&& o) noexcept {
|
reference& operator=(reference&& o) noexcept {
|
||||||
L = o.L;
|
luastate = o.luastate;
|
||||||
ref = o.ref;
|
ref = o.ref;
|
||||||
|
|
||||||
o.L = nullptr;
|
o.luastate = nullptr;
|
||||||
o.ref = LUA_NOREF;
|
o.ref = LUA_NOREF;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
reference(const reference& o) noexcept {
|
reference(const reference& o) noexcept {
|
||||||
L = o.L;
|
luastate = o.luastate;
|
||||||
ref = o.copy();
|
ref = o.copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
reference& operator=(const reference& o) noexcept {
|
reference& operator=(const reference& o) noexcept {
|
||||||
L = o.L;
|
luastate = o.luastate;
|
||||||
ref = o.copy();
|
ref = o.copy();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
int push() const noexcept {
|
int push() const noexcept {
|
||||||
lua_rawgeti(L, LUA_REGISTRYINDEX, ref);
|
lua_rawgeti(lua_state(), LUA_REGISTRYINDEX, ref);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,12 +151,12 @@ namespace sol {
|
||||||
|
|
||||||
type get_type() const noexcept {
|
type get_type() const noexcept {
|
||||||
auto pp = stack::push_pop(*this);
|
auto pp = stack::push_pop(*this);
|
||||||
int result = lua_type(L, -1);
|
int result = lua_type(lua_state(), -1);
|
||||||
return static_cast<type>(result);
|
return static_cast<type>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
lua_State* lua_state() const noexcept {
|
lua_State* lua_state() const noexcept {
|
||||||
return L;
|
return luastate;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -258,7 +258,7 @@ namespace sol {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline auto tagged_get(types<T>, lua_State* L, int index, record& tracking) -> decltype(stack_detail::unchecked_get<T>(L, index, tracking)) {
|
inline auto tagged_get(types<T>, lua_State* L, int index, record& tracking) -> decltype(stack_detail::unchecked_get<T>(L, index, tracking)) {
|
||||||
auto op = check_get<T>(L, index, type_panic, tracking);
|
auto op = check_get<T>(L, index, type_panic, tracking);
|
||||||
return *op;
|
return *std::move(op);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
|
@ -108,14 +108,14 @@ namespace sol {
|
||||||
typedef global_table::iterator iterator;
|
typedef global_table::iterator iterator;
|
||||||
typedef global_table::const_iterator const_iterator;
|
typedef global_table::const_iterator const_iterator;
|
||||||
|
|
||||||
state_view(lua_State* L) :
|
state_view(lua_State* Ls) :
|
||||||
L(L),
|
L(Ls),
|
||||||
reg(L, LUA_REGISTRYINDEX),
|
reg(Ls, LUA_REGISTRYINDEX),
|
||||||
global(L, detail::global_) {
|
global(Ls, detail::global_) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
state_view(this_state L) : state_view(L.L){
|
state_view(this_state Ls) : state_view(Ls.L){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@ namespace sol {
|
||||||
const char* p;
|
const char* p;
|
||||||
|
|
||||||
string_shim(const std::string& r) : string_shim(r.data(), r.size()) {}
|
string_shim(const std::string& r) : string_shim(r.data(), r.size()) {}
|
||||||
string_shim(const char* p) : string_shim(p, std::char_traits<char>::length(p)) {}
|
string_shim(const char* ptr) : string_shim(ptr, std::char_traits<char>::length(ptr)) {}
|
||||||
string_shim(const char* p, std::size_t s) : s(s), p(p) {}
|
string_shim(const char* ptr, std::size_t sz) : s(sz), p(ptr) {}
|
||||||
|
|
||||||
static int compare(const char* lhs_p, std::size_t lhs_sz, const char* rhs_p, std::size_t rhs_sz) {
|
static int compare(const char* lhs_p, std::size_t lhs_sz, const char* rhs_p, std::size_t rhs_sz) {
|
||||||
int result = std::char_traits<char>::compare(lhs_p, rhs_p, lhs_sz < rhs_sz ? lhs_sz : rhs_sz);
|
int result = std::char_traits<char>::compare(lhs_p, rhs_p, lhs_sz < rhs_sz ? lhs_sz : rhs_sz);
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
namespace sol {
|
namespace sol {
|
||||||
namespace detail {
|
namespace detail {
|
||||||
template <std::size_t n>
|
template <std::size_t n>
|
||||||
struct clean { lua_State* L; clean(lua_State* L) : L(L) {} ~clean() { lua_pop(L, static_cast<int>(n)); } };
|
struct clean { lua_State* L; clean(lua_State* luastate) : L(luastate) {} ~clean() { lua_pop(L, static_cast<int>(n)); } };
|
||||||
struct ref_clean { lua_State* L; int& n; ref_clean(lua_State* L, int& n) : L(L), n(n) {} ~ref_clean() { lua_pop(L, static_cast<int>(n)); } };
|
struct ref_clean { lua_State* L; int& n; ref_clean(lua_State* luastate, int& n) : L(luastate), n(n) {} ~ref_clean() { lua_pop(L, static_cast<int>(n)); } };
|
||||||
inline int fail_on_newindex(lua_State* L) {
|
inline int fail_on_newindex(lua_State* L) {
|
||||||
return luaL_error(L, "sol: cannot modify the elements of an enumeration table");
|
return luaL_error(L, "sol: cannot modify the elements of an enumeration table");
|
||||||
}
|
}
|
||||||
|
@ -457,6 +457,10 @@ namespace sol {
|
||||||
static const int narr = static_cast<int>(meta::count_2_for_pack<std::is_integral, Args...>::value);
|
static const int narr = static_cast<int>(meta::count_2_for_pack<std::is_integral, Args...>::value);
|
||||||
return create(std::forward<Name>(name), narr, sizeof...(Args) / 2 - narr, std::forward<Args>(args)...);
|
return create(std::forward<Name>(name), narr, sizeof...(Args) / 2 - narr, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~basic_table_core() {
|
||||||
|
|
||||||
|
}
|
||||||
};
|
};
|
||||||
} // sol
|
} // sol
|
||||||
|
|
||||||
|
|
|
@ -252,14 +252,14 @@ namespace sol {
|
||||||
struct closure {
|
struct closure {
|
||||||
lua_CFunction c_function;
|
lua_CFunction c_function;
|
||||||
std::tuple<Upvalues...> upvalues;
|
std::tuple<Upvalues...> upvalues;
|
||||||
closure(lua_CFunction f, Upvalues... upvalues) : c_function(f), upvalues(std::forward<Upvalues>(upvalues)...) {}
|
closure(lua_CFunction f, Upvalues... targetupvalues) : c_function(f), upvalues(std::forward<Upvalues>(targetupvalues)...) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct closure<> {
|
struct closure<> {
|
||||||
lua_CFunction c_function;
|
lua_CFunction c_function;
|
||||||
int upvalues;
|
int upvalues;
|
||||||
closure(lua_CFunction f, int upvalues = 0) : c_function(f), upvalues(upvalues) {}
|
closure(lua_CFunction f, int upvalue_count = 0) : c_function(f), upvalues(upvalue_count) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef closure<> c_closure;
|
typedef closure<> c_closure;
|
||||||
|
|
|
@ -42,7 +42,7 @@ namespace sol {
|
||||||
stack_proxy sp;
|
stack_proxy sp;
|
||||||
|
|
||||||
va_iterator() : L(nullptr), index((std::numeric_limits<int>::max)()), stacktop((std::numeric_limits<int>::max)()) {}
|
va_iterator() : L(nullptr), index((std::numeric_limits<int>::max)()), stacktop((std::numeric_limits<int>::max)()) {}
|
||||||
va_iterator(lua_State* L, int index, int stacktop) : L(L), index(index), stacktop(stacktop), sp(L, index) {}
|
va_iterator(lua_State* luastate, int idx, int topidx) : L(luastate), index(idx), stacktop(topidx), sp(luastate, idx) {}
|
||||||
|
|
||||||
reference operator*() {
|
reference operator*() {
|
||||||
return stack_proxy(L, index);
|
return stack_proxy(L, index);
|
||||||
|
@ -153,7 +153,7 @@ namespace sol {
|
||||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||||
|
|
||||||
variadic_args() = default;
|
variadic_args() = default;
|
||||||
variadic_args(lua_State* L, int index = -1) : L(L), index(lua_absindex(L, index)), stacktop(lua_gettop(L)) {}
|
variadic_args(lua_State* luastate, int stackindex = -1) : L(luastate), index(lua_absindex(luastate, stackindex)), stacktop(lua_gettop(luastate)) {}
|
||||||
variadic_args(const variadic_args&) = default;
|
variadic_args(const variadic_args&) = default;
|
||||||
variadic_args& operator=(const variadic_args&) = default;
|
variadic_args& operator=(const variadic_args&) = default;
|
||||||
variadic_args(variadic_args&& o) : L(o.L), index(o.index), stacktop(o.stacktop) {
|
variadic_args(variadic_args&& o) : L(o.L), index(o.index), stacktop(o.stacktop) {
|
||||||
|
|
|
@ -144,6 +144,7 @@ tc3 = TestClass03(tc1)
|
||||||
TestClass01& tc1 = lua["tc1"];
|
TestClass01& tc1 = lua["tc1"];
|
||||||
TestClass02& tc2 = lua["tc2"];
|
TestClass02& tc2 = lua["tc2"];
|
||||||
TestClass03& tc3 = lua["tc3"];
|
TestClass03& tc3 = lua["tc3"];
|
||||||
|
REQUIRE(tc0.Thing() == 123);
|
||||||
REQUIRE(tc1.a == 1);
|
REQUIRE(tc1.a == 1);
|
||||||
REQUIRE(tc2.a == 1);
|
REQUIRE(tc2.a == 1);
|
||||||
REQUIRE(tc2.b == 123);
|
REQUIRE(tc2.b == 123);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user