Skip to content

added get_version to get generation from entity#1891

Merged
SanderMertens merged 3 commits into
SanderMertens:masterfrom
tabdroid-1:get_version
Dec 12, 2025
Merged

added get_version to get generation from entity#1891
SanderMertens merged 3 commits into
SanderMertens:masterfrom
tabdroid-1:get_version

Conversation

@tabdroid-1

Copy link
Copy Markdown
Contributor
    flecs::world world {};
    flecs::entity entity = m_World.entity();
    std::cout << "Entity id: " << entity << " Entity version: " << world.get_version(entity) << "\n";
    entity.destruct();

    entity = m_World.entity();
    std::cout << "Entity id: " << entity << " Entity version: " << world.get_version(entity) << "\n";
    entity.destruct();

    entity = m_World.entity();
    std::cout << "Entity id: " << entity << " Entity version: " << world.get_version(entity) << "\n";
    entity.destruct();

    entity = m_World.entity();
    std::cout << "Entity id: " << entity << " Entity version: " << world.get_version(entity) << "\n";
    entity.destruct();

output

Entity id: 578 Entity version: 0
Entity id: 4294967874 Entity version: 1
Entity id: 8589935170 Entity version: 2
Entity id: 12884902466 Entity version: 3

@zachrammell

Copy link
Copy Markdown

What's the rationale behind having get_version be a method of world in the C++ API if the equivalent procedure in C doesn't need a world? It would probably be more useful as a method of entity, no?

@tabdroid-1

Copy link
Copy Markdown
Contributor Author

What's the rationale behind having get_version be a method of world in the C++ API if the equivalent procedure in C doesn't need a world? It would probably be more useful as a method of entity, no?

My rationale was if world has set_version then user will probably think there is get_version. Which was the case for me

@tabdroid-1

Copy link
Copy Markdown
Contributor Author

Screenshot_20251212-113947_Discord.png

@SanderMertens

Copy link
Copy Markdown
Owner

LGTM!

@SanderMertens SanderMertens merged commit e933342 into SanderMertens:master Dec 12, 2025
74 checks passed
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

Successfully merging this pull request may close these issues.

3 participants