Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot directly bind b2Vec2 to a table entry #1596

Open
linsyking opened this issue Apr 12, 2024 · 0 comments
Open

Cannot directly bind b2Vec2 to a table entry #1596

linsyking opened this issue Apr 12, 2024 · 0 comments

Comments

@linsyking
Copy link

Hi, I met with a problem when using sol with box2d.

Box2d has a class called b2Vec2, and I want to set an entry of a table to a b2Vec2.

I tried:

sol::table nt = s.create_table();
nt["a"] = b2Vec2(1, 2);

The compiler then complains an error:

sol.hpp:18406:143: error: no type named ‘function_pointer_type’ in ‘sol::wrapper<b2Vec2, void>::traits_type’ {aka ‘struct sol::lua_bind_traits<b2Vec2>’}
[build] 18406 |                                                 return agnostic_lua_call_wrapper<fp_t, is_index, is_variable, checked, boost, clean_stack> {}.call(

However, if I change the code to:

sol::table nt = s.create_table();
sol::object o = sol::make_object(s, b2Vec2(1, 2));
nt["a"] = o;

Then it works.

I wonder why this happens and can it be fixed? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant