1#include <script_managed.h>
2#include <stdio.h>
3
4
5
6
7
8
9
10
11
16 for (
int i = 0; i < it.
count; i ++) {
18 }
19 }
20}
21
22int main(int argc, char *argv[]) {
24
26 .code =
27 "Sun {\n"
28 " Mercury {}\n"
29 " Venus {}\n"
30 " Earth {}\n"
31 " Mars {}\n"
32 " Jupiter {}\n"
33 " Saturn {}\n"
34 " Neptune {}\n"
35 " Uranus {}\n"
36 " Pluto {}\n"
37 "}\n"
38 });
39
41 printf("script failed to run\n");
42 }
43
44 printf("Before updating script:\n");
45 print_planets(world);
46
48 "Sun {\n"
49 " Mercury {}\n"
50 " Venus {}\n"
51 " Earth {}\n"
52 " Mars {}\n"
53 " Jupiter {}\n"
54 " Saturn {}\n"
55 " Neptune {}\n"
56 " Uranus {}\n"
57
58 "}\n"
59 );
60
61 printf("\nAfter updating script:\n");
62 print_planets(world);
63
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87}
FLECS_API int ecs_script_update(ecs_world_t *world, ecs_entity_t script, ecs_entity_t instance, const char *code)
Update script with new code.
ecs_id_t ecs_entity_t
An entity identifier.
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
script_builder script(const char *name=nullptr) const
Build a script.
bool ecs_children_next(ecs_iter_t *it)
Progress an iterator created with ecs_children().
ecs_iter_t ecs_children(const ecs_world_t *world, ecs_entity_t parent)
Iterate children of a parent.
ecs_entity_t ecs_lookup(const ecs_world_t *world, const char *path)
Look up an entity by its path.
const char * ecs_get_name(const ecs_world_t *world, ecs_entity_t entity)
Get the name of an entity.
int ecs_fini(ecs_world_t *world)
Delete a world.
ecs_world_t * ecs_init_w_args(int argc, char *argv[])
Create a new world with arguments.
int32_t count
Number of entities to iterate.
const ecs_entity_t * entities
Entity identifiers.