flecs-hub/flecs-json

Example 08_serialize_entity contains undefined function

julhe opened this issue · 0 comments

julhe commented

char *str = ecs_ptr_to_json(world, player);

This function doesn't exist in that form. Theres only

flecs-json/src/main.c

Lines 331 to 335 in 9c64f27

char* ecs_ptr_to_json(
ecs_world_t *world,
ecs_entity_t type,
void* ptr)
{

Also: even when using this version, it would always fail for me with. Example

//...
ecs_entity_t player = ecs_set(world, ecs_set(world, 0,
        Foo, {200,100,1}),
        Bar, {32.0f});

char *str = ecs_ptr_to_json(world, player, 0);
// err : assert(component != 0) ..\flecs\src\entity.c:54: internal error

So, is this example broken? (By the way: I found out that ecs_entity_to_json actually would do what I expect from the example)