mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Fix test failure
This commit is contained in:
parent
b6c2f1c6d5
commit
8cd3b18f7b
|
@ -111,13 +111,13 @@ private:
|
|||
|
||||
public:
|
||||
template<typename... Args>
|
||||
userdata(Args&&... args) : userdata(classname, default_constructor, std::forward<Args>(args)...) {}
|
||||
userdata(Args&&... args): userdata(classname, default_constructor, std::forward<Args>(args)...) {}
|
||||
|
||||
template<typename... Args, typename... CArgs>
|
||||
userdata(constructors<CArgs...> c, Args&&... args) : userdata(classname, std::move(c), std::forward<Args>(args)...) {}
|
||||
userdata(constructors<CArgs...> c, Args&&... args): userdata(classname, std::move(c), std::forward<Args>(args)...) {}
|
||||
|
||||
template<typename... Args, typename... CArgs>
|
||||
userdata(std::string name, constructors<CArgs...>, Args&&... args) : luaname(std::move(name)) {
|
||||
userdata(std::string name, constructors<CArgs...>, Args&&... args): luaname(std::move(name)) {
|
||||
functionnames.reserve(sizeof...(args) + 2);
|
||||
functiontable.reserve(sizeof...(args) + 3);
|
||||
functions.reserve(sizeof...(args) + 2);
|
||||
|
@ -131,6 +131,10 @@ public:
|
|||
functiontable.push_back({ nullptr, nullptr });
|
||||
}
|
||||
|
||||
template<typename... Args, typename... CArgs>
|
||||
userdata(const char* name, constructors<CArgs...> c, Args&&... args) :
|
||||
userdata(std::string(name), std::move(c), std::forward<Args>(args)...) {}
|
||||
|
||||
void register_into(const table& s) {}
|
||||
};
|
||||
|
||||
|
@ -140,6 +144,6 @@ const std::string userdata<T>::classname = detail::demangle(typeid(T));
|
|||
template<typename T>
|
||||
const std::string userdata<T>::meta = std::string("sol.stateful.").append(classname);
|
||||
|
||||
}
|
||||
} // sol
|
||||
|
||||
#endif // SOL_USERDATA_HPP
|
||||
|
|
|
@ -43,7 +43,7 @@ struct fuser {
|
|||
return x + y + 2;
|
||||
}
|
||||
};
|
||||
}
|
||||
} // crapola
|
||||
|
||||
int plop_xyz(int x, int y, std::string z) {
|
||||
std::cout << x << " " << y << " " << z << std::endl;
|
||||
|
@ -386,7 +386,7 @@ TEST_CASE("tables/userdata constructors", "Show that we can create classes from
|
|||
sol::state lua;
|
||||
|
||||
sol::constructors<sol::types<>, sol::types<int>, sol::types<int, int>> con;
|
||||
sol::userdata<crapola::fuser> lc(con, &crapola::fuser::add, "add", &crapola::fuser::add2, "add2");
|
||||
sol::userdata<crapola::fuser> lc("crapola_fuser", con, &crapola::fuser::add, "add", &crapola::fuser::add2, "add2");
|
||||
lua.set_class(lc);
|
||||
|
||||
lua.script(
|
||||
|
|
Loading…
Reference in New Issue
Block a user