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

Impossible to create an inner usertype/enum in a usertype #1616

Open
kunitoki opened this issue Jul 11, 2024 · 1 comment
Open

Impossible to create an inner usertype/enum in a usertype #1616

kunitoki opened this issue Jul 11, 2024 · 1 comment

Comments

@kunitoki
Copy link

I have an API that has classes and inner classes that i should be binding to lua mirroring the c++ one.
It seems like basic_usertype don't forward base_t::new_enum and base_t::new_usertype so it is not possible to register inner enums and inner classes.

struct outer
{
    struct inner
    {
    };
};

auto outer_class = lua.new_usertype<outer>("outer");
auto inner_class = outer_class.new_usertype<inner>("inner");

Seems quite limiting not being able to do this.

@deadlocklogic
Copy link
Contributor

I usually use this approach which works fine:

auto outer_class = lua.new_usertype<outer>("outer");
auto inner_class = lua.new_usertype<inner>("outer::inner");
lua["outer"]["inner"] = lua["outer::inner"];

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

2 participants