#include <sol.hpp>
#include <cassert>
struct vars {
int boop = 0;
};
int main() {
sol::state lua;
lua.new_userdata<vars>("vars", "boop", &vars::boop);
lua.script("local beep = vars.new()\n"
"beep.boop = 1");
assert(lua.get<vars>("beep").boop == 1);
}
When i use a simple examples (basic.cpp or variables.cpp), the code compile and works as expected but when i use the set_function or new_userdata functions like in the code above, i get the following error:
||=== Build: Debug in lua-test (compiler: GNU GCC Compiler) ===|
C:\...\sol-master\sol\traits.hpp||In instantiation of 'struct sol::detail::check_deducible_signature<void (vars::*)()>':|
...\sol-master\sol\traits.hpp|159|required from 'struct sol::has_deducible_signature<void (vars::*)()>'|
...\sol-master\sol\traits.hpp|239|required from 'struct sol::function_traits<void (vars::*)()>'|
...\sol-master\sol\traits.hpp|252|required from 'struct sol::detail::member_traits<void (vars::*)(), false>'|
...\sol-master\sol\function_types.hpp|37|required from 'struct sol::detail::functor<vars, void (vars::*)(), void>'|
...\sol-master\sol\function_types.hpp|377|required from 'struct sol::userdata_function_core<void (vars::*)(), vars>'|
...\sol-master\sol\function_types.hpp|500|required from 'struct sol::userdata_indexing_function<void (vars::*)(), vars>'|
...\lua\sol-master\sol\userdata.hpp|165|required from 'void sol::userdata<T>::build_function_tables(sol::userdata<T>::function_map_t*&, sol::userdata<T>::function_map_t*&) [with unsigned int N = 0u; T = vars; sol::userdata<T>::function_map_t = std::unordered_map<std::basic_string<char>, std::pair<std::unique_ptr<sol::base_function>, bool> >]'|
...\lua\sol-master\sol\userdata.hpp|301|required from 'void sol::userdata<T>::build_function_tables(sol::userdata<T>::function_map_t*&, sol::userdata<T>::function_map_t*&, std::string, Fx&&, Args&& ...) [with unsigned int N = 0u; Fx = int vars::*; Args = {}; T = vars; sol::userdata<T>::function_map_t = std::unordered_map<std::basic_string<char>, std::pair<std::unique_ptr<sol::base_function>, bool> >; std::string = std::basic_string<char>]'|
...\sol\userdata.hpp|330|required from 'sol::userdata<T>::userdata(std::string, sol::constructors<CArgs ...>, Args&& ...) [with Args = {const char (&)[5], int vars::*}; CArgs = {sol::types<>}; T = vars; std::string = std::basic_string<char>]'|
...\sol-master\sol\state.hpp|169|required from 'sol::state& sol::state::new_userdata(const string&, sol::constructors<CArgs ...>, Args&& ...) [with Class = vars; CArgs = {sol::types<>}; Args = {const char (&)[5], int vars::*}; sol::state = sol::state; std::string = std::basic_string<char>]'|
...\sol-master\sol\state.hpp|164|required from 'sol::state& sol::state::new_userdata(const string&, Args&& ...) [with Class = vars; CTor = {}; Args = {const char (&)[5], int vars::*}; sol::state = sol::state; std::string = std::basic_string<char>]'|
...\lua-test\main.cpp|10|required from here|
...\sol-master\sol\traits.hpp|154|error: invalid use of incomplete type 'struct sol::detail::nat'|
...\sol-master\sol\traits.hpp|152|error: forward declaration of 'struct sol::detail::nat'|
...\sol-master\sol\traits.hpp||In instantiation of 'struct sol::function_traits<void (vars::*)()>':|
...\sol-master\sol\traits.hpp|252|required from 'struct sol::detail::member_traits<void (vars::*)(), false>'|
...\sol-master\sol\function_types.hpp|37|required from 'struct sol::detail::functor<vars, void (vars::*)(), void>'|
...\lua\sol-master\sol\function_types.hpp|377|required from 'struct sol::userdata_function_core<void (vars::*)(), vars>'|
...\lua\sol-master\sol\function_types.hpp|500|required from 'struct sol::userdata_indexing_function<void (vars::*)(), vars>'|
...\lua\sol-master\sol\userdata.hpp|165|required from 'void sol::userdata<T>::build_function_tables(sol::userdata<T>::function_map_t*&, sol::userdata<T>::function_map_t*&) [with unsigned int N = 0u; T = vars; sol::userdata<T>::function_map_t = std::unordered_map<std::basic_string<char>, std::pair<std::unique_ptr<sol::base_function>, bool> >]'|
...\lua\sol-master\sol\userdata.hpp|301|required from 'void sol::userdata<T>::build_function_tables(sol::userdata<T>::function_map_t*&, sol::userdata<T>::function_map_t*&, std::string, Fx&&, Args&& ...) [with unsigned int N = 0u; Fx = int vars::*; Args = {}; T = vars; sol::userdata<T>::function_map_t = std::unordered_map<std::basic_string<char>, std::pair<std::unique_ptr<sol::base_function>, bool> >; std::string = std::basic_string<char>]'|
...\lua\sol-master\sol\userdata.hpp|330|required from 'sol::userdata<T>::userdata(std::string, sol::constructors<CArgs ...>, Args&& ...) [with Args = {const char (&)[5], int vars::*}; CArgs = {sol::types<>}; T = vars; std::string = std::basic_string<char>]'|
...\lua\sol-master\sol\state.hpp|169|required from 'sol::state& sol::state::new_userdata(const string&, sol::constructors<CArgs ...>, Args&& ...) [with Class = vars; CArgs = {sol::types<>}; Args = {const char (&)[5], int vars::*}; sol::state = sol::state; std::string = std::basic_string<char>]'|
...\lua\sol-master\sol\state.hpp|164|required from 'sol::state& sol::state::new_userdata(const string&, Args&& ...) [with Class = vars; CTor = {}; Args = {const char (&)[5], int vars::*}; sol::state = sol::state; std::string = std::basic_string<char>]'|
...\lua-test\main.cpp|10|required from here|
...\sol-master\sol\traits.hpp|239|error: 'value' is not a member of 'sol::has_deducible_signature<void (vars::*)()>'|
...\sol-master\sol\function_types.hpp||In instantiation of 'struct sol::detail::functor<vars, void (vars::*)(), void>':|
...\sol-master\sol\function_types.hpp|377|required from 'struct sol::userdata_function_core<void (vars::*)(), vars>'|
...\sol-master\sol\function_types.hpp|500|required from 'struct sol::userdata_indexing_function<void (vars::*)(), vars>'|
...\sol-master\sol\userdata.hpp|165|required from 'void sol::userdata<T>::build_function_tables(sol::userdata<T>::function_map_t*&, sol::userdata<T>::function_map_t*&) [with unsigned int N = 0u; T = vars; sol::userdata<T>::function_map_t = std::unordered_map<std::basic_string<char>, std::pair<std::unique_ptr<sol::base_function>, bool> >]'|
...\sol-master\sol\userdata.hpp|301|required from 'void sol::userdata<T>::build_function_tables(sol::userdata<T>::function_map_t*&, sol::userdata<T>::function_map_t*&, std::string, Fx&&, Args&& ...) [with unsigned int N = 0u; Fx = int vars::*; Args = {}; T = vars; sol::userdata<T>::function_map_t = std::unordered_map<std::basic_string<char>, std::pair<std::unique_ptr<sol::base_function>, bool> >; std::string = std::basic_string<char>]'|
...\sol-master\sol\userdata.hpp|330|required from 'sol::userdata<T>::userdata(std::string, sol::constructors<CArgs ...>, Args&& ...) [with Args = {const char (&)[5], int vars::*}; CArgs = {sol::types<>}; T = vars; std::string = std::basic_string<char>]'|
...\sol-master\sol\state.hpp|169|required from 'sol::state& sol::state::new_userdata(const string&, sol::constructors<CArgs ...>, Args&& ...) [with Class = vars; CArgs = {sol::types<>}; Args = {const char (&)[5], int vars::*}; sol::state = sol::state; std::string = std::basic_string<char>]'|
...\sol-master\sol\state.hpp|164|required from 'sol::state& sol::state::new_userdata(const string&, Args&& ...) [with Class = vars; CTor = {}; Args = {const char (&)[5], int vars::*}; sol::state = sol::state; std::string = std::basic_string<char>]'|
...\lua-test\main.cpp|10|required from here|
...\sol-master\sol\function_types.hpp|37|error: no type named 'args_type' in 'struct sol::detail::member_traits<void (vars::*)(), false>'|
...\sol-master\sol\function_types.hpp|38|error: no type named 'return_type' in 'struct sol::detail::member_traits<void (vars::*)(), false>'|
...\sol-master\sol\function_types.hpp|59|error: no type named 'return_type' in 'struct sol::detail::member_traits<void (vars::*)(), false>'|
...\sol-master\sol\function_types.hpp||In member function 'int sol::userdata_indexing_function<Function, Tp>::fx_call(lua_State*) [with Tx = vars*; Function = void (vars::*)(); Tp = vars; lua_State = lua_State]':|
...\sol-master\sol\function_types.hpp|540|warning: control reaches end of non-void function [-Wreturn-type]|
...\sol-master\sol\function_types.hpp||In member function 'int sol::userdata_indexing_function<Function, Tp>::fx_call(lua_State*) [with Tx = vars; Function = void (vars::*)(); Tp = vars; lua_State = lua_State]':|
...\sol-master\sol\function_types.hpp|540|warning: control reaches end of non-void function [-Wreturn-type]|
||=== Build failed: 6 error(s), 35 warning(s) (0 minute(s), 0 second(s)) ===|