mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
Switch member function pointer and string pair in initialisation
This commit is contained in:
parent
b323a62b2a
commit
2f76b96061
|
@ -101,7 +101,7 @@ private:
|
||||||
void build_function_tables() {}
|
void build_function_tables() {}
|
||||||
|
|
||||||
template<std::size_t n, typename... Args, typename Ret>
|
template<std::size_t n, typename... Args, typename Ret>
|
||||||
void build_function_tables(Ret T::* func, std::string name, Args&&... args) {
|
void build_function_tables(std::string name,Ret T::* func, Args&&... args) {
|
||||||
typedef typename std::decay<decltype(func)>::type fx_t;
|
typedef typename std::decay<decltype(func)>::type fx_t;
|
||||||
functionnames.push_back(std::move(name));
|
functionnames.push_back(std::move(name));
|
||||||
functions.emplace_back(detail::make_unique<userdata_function<fx_t, T>>(std::move(func)));
|
functions.emplace_back(detail::make_unique<userdata_function<fx_t, T>>(std::move(func)));
|
||||||
|
|
|
@ -358,7 +358,7 @@ TEST_CASE("tables/userdata", "Show that we can create classes from userdata and
|
||||||
|
|
||||||
sol::state lua;
|
sol::state lua;
|
||||||
|
|
||||||
sol::userdata<fuser> lc{ &fuser::add, "add", &fuser::add2, "add2" };
|
sol::userdata<fuser> lc{ "add", &fuser::add, "add2", &fuser::add2 };
|
||||||
lua.set_class(lc);
|
lua.set_class(lc);
|
||||||
|
|
||||||
lua.script("a = fuser:new()\n"
|
lua.script("a = fuser:new()\n"
|
||||||
|
@ -386,7 +386,7 @@ TEST_CASE("tables/userdata constructors", "Show that we can create classes from
|
||||||
sol::state lua;
|
sol::state lua;
|
||||||
|
|
||||||
sol::constructors<sol::types<>, sol::types<int>, sol::types<int, int>> con;
|
sol::constructors<sol::types<>, sol::types<int>, sol::types<int, int>> con;
|
||||||
sol::userdata<crapola::fuser> lc("crapola_fuser", con, &crapola::fuser::add, "add", &crapola::fuser::add2, "add2");
|
sol::userdata<crapola::fuser> lc("crapola_fuser", con, "add", &crapola::fuser::add, "add2", &crapola::fuser::add2);
|
||||||
lua.set_class(lc);
|
lua.set_class(lc);
|
||||||
|
|
||||||
lua.script(
|
lua.script(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user