mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Fix compiler errors, tests failing however
This commit is contained in:
parent
a525760178
commit
63bc2b06cb
@ -105,17 +105,21 @@ struct static_member_function {
|
||||
|
||||
struct base_function {
|
||||
static int base_call(lua_State* L, void* inheritancedata) {
|
||||
if (inheritancedata == nullptr)
|
||||
if (inheritancedata == nullptr) {
|
||||
throw sol_error("call from Lua to C++ function has null data");
|
||||
}
|
||||
|
||||
base_function* pfx = static_cast<base_function*>(inheritancedata);
|
||||
base_function& fx = *pfx;
|
||||
int r = fx(L);
|
||||
return r;
|
||||
}
|
||||
|
||||
static int base_gc(lua_State* L, void* udata) {
|
||||
if (udata == nullptr)
|
||||
static int base_gc(lua_State*, void* udata) {
|
||||
if (udata == nullptr) {
|
||||
throw sol_error("call from lua to C++ gc function with null data");
|
||||
}
|
||||
|
||||
base_function* ptr = static_cast<base_function*>(udata);
|
||||
std::default_delete<base_function> dx{};
|
||||
dx(ptr);
|
||||
|
@ -240,7 +240,7 @@ inline void push_tuple(lua_State* L, indices<I...>, T&& tuplen) {
|
||||
}
|
||||
|
||||
template<typename F, typename... Vs, typename... Args>
|
||||
inline auto ltr_get(lua_State*, int index, F&& f, types<Args...>, types<>, Vs&&... vs) -> decltype(f(std::forward<Vs>(vs)...)) {
|
||||
inline auto ltr_get(lua_State*, int, F&& f, types<Args...>, types<>, Vs&&... vs) -> decltype(f(std::forward<Vs>(vs)...)) {
|
||||
return f(std::forward<Vs>(vs)...);
|
||||
}
|
||||
template<typename F, typename Head, typename... Tail, typename... Vs, typename... Args>
|
||||
|
@ -50,7 +50,7 @@ private:
|
||||
template<typename... TTypes>
|
||||
struct constructor {
|
||||
template<typename... Args>
|
||||
static void do_constructor(lua_State* L, T* obj, call_syntax syntax, int argcount, types<Args...>) {
|
||||
static void do_constructor(lua_State* L, T* obj, call_syntax syntax, int, types<Args...>) {
|
||||
auto fx = [&obj] (Args&&... args) -> void {
|
||||
std::allocator<T> alloc{};
|
||||
alloc.construct(obj, std::forward<Args>(args)...);
|
||||
@ -58,7 +58,7 @@ private:
|
||||
stack::get_call(L, 1 + static_cast<int>(syntax), fx, types<Args...>());
|
||||
}
|
||||
|
||||
static void match_constructor(lua_State* L, T* obj, call_syntax, int argcount) {
|
||||
static void match_constructor(lua_State*, T*, call_syntax, int) {
|
||||
throw sol_error("No matching constructor for the arguments provided");
|
||||
}
|
||||
|
||||
@ -77,9 +77,7 @@ private:
|
||||
|
||||
void* udata = lua_newuserdata(L, sizeof(T));
|
||||
T* obj = static_cast<T*>(udata);
|
||||
match_constructor(L, obj, syntax,
|
||||
argcount - static_cast<int>(syntax),
|
||||
std::common_type<TTypes>::type()...);
|
||||
match_constructor(L, obj, syntax, argcount - static_cast<int>(syntax), typename std::common_type<TTypes>::type()...);
|
||||
|
||||
luaL_getmetatable(L, meta.c_str());
|
||||
lua_setmetatable(L, -2);
|
||||
@ -91,9 +89,6 @@ private:
|
||||
template<std::size_t n>
|
||||
struct destructor {
|
||||
static int destruct(lua_State* L) {
|
||||
/*for(std::size_t i = 0; i < n; ++i) {
|
||||
base_function::base_gc(L, stack::get<lightuserdata_t>(L, i + 1));
|
||||
}*/
|
||||
userdata_t udata = stack::get<userdata_t>(L, 1);
|
||||
T* obj = static_cast<T*>(udata.value);
|
||||
std::allocator<T> alloc{};
|
||||
@ -103,9 +98,7 @@ private:
|
||||
};
|
||||
|
||||
template<std::size_t n>
|
||||
void build_function_tables() {
|
||||
|
||||
}
|
||||
void build_function_tables() {}
|
||||
|
||||
template<std::size_t n, typename... Args, typename Ret, typename... MArgs>
|
||||
void build_function_tables(Ret(T::* func)(MArgs...), std::string name, Args&&... args) {
|
||||
@ -138,7 +131,7 @@ public:
|
||||
functiontable.push_back({ nullptr, nullptr });
|
||||
}
|
||||
|
||||
void register_into(const table& s) { }
|
||||
void register_into(const table& s) {}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
|
Loading…
x
Reference in New Issue
Block a user