sol icon indicating copy to clipboard operation
sol copied to clipboard

Unable to register a table

Open perciun-andrei opened this issue 10 years ago • 2 comments

The following piece of code was not compiling

sol::state state;
sol::table some_table = state.create_table();
state.set("some_table", some_table);

The compilation error which was fixed

Users/andreiperciun/Developer/paper-rl/build/sources/libraries/sol/sol_develop/src/project-sol/sol/stack.hpp:344:15: error: cannot initialize return object of type 'int' with an rvalue of type 'void'
       return ref.push();
              ^~~~~~~~~~
/Users/andreiperciun/Developer/paper-rl/build/sources/libraries/sol/sol_develop/src/project-sol/sol/stack.hpp:97:37: note: in instantiation of function template specialization
      'sol::stack::pusher<sol::table, void>::push<sol::table, 0>' requested here
    return pusher<Unqualified<T>>{}.push(L, std::forward<T>(t), std::forward<Args>(args)...);
                                    ^
/Users/andreiperciun/Developer/paper-rl/build/sources/libraries/sol/sol_develop/src/project-sol/sol/table.hpp:70:16: note: in instantiation of function template specialization
      'sol::stack::push<sol::table &>' requested here
        stack::push(state(), std::forward<U>(value));
               ^
/Users/andreiperciun/Developer/paper-rl/build/sources/libraries/sol/sol_develop/src/project-sol/sol/state.hpp:147:16: note: in instantiation of function template specialization
      'sol::table::set<char const (&)[8], sol::table &>' requested here
        global.set(std::forward<T>(key), std::forward<U>(value));

perciun-andrei avatar Oct 19 '15 14:10 perciun-andrei

Hey, thanks for the PR!

I fixed this in my develop branch of sol, waiting to be PRd at #62. Currently, the original author seems really busy, so it might be a while before this all makes it in.

ThePhD avatar Oct 20 '15 19:10 ThePhD

Thank you for your comment. Let me know if I need to delete this PR.

perciun-andrei avatar Oct 21 '15 06:10 perciun-andrei