Flecs: include/flecs/addons/script.h Source File
Description: A fast entity component system (ECS) for C & C++

| Flecs v4.1 A fast entity component system (ECS) for C & C++

Loading...
Searching...
No Matches
script.h
Go to the documentation of this file.
1
7
8#ifdef FLECS_SCRIPT
9
17
18#ifndef FLECS_META
19#define FLECS_META
20#endif
21
22#ifndef FLECS_DOC
23#define FLECS_DOC
24#endif
25
26#ifndef FLECS_PARSER
27#define FLECS_PARSER
28#endif
29
30#ifndef FLECS_SCRIPT_H
31#define FLECS_SCRIPT_H
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37#define FLECS_SCRIPT_FUNCTION_ARGS_MAX (16)
38
39/* Must be the same as EcsPrimitiveKindLast */
40#define FLECS_SCRIPT_VECTOR_FUNCTION_COUNT (18)
41
42FLECS_API
43extern ECS_COMPONENT_DECLARE(EcsScript);
44
45FLECS_API
46extern ECS_DECLARE(EcsScriptTemplate);
47
48FLECS_API
49extern ECS_COMPONENT_DECLARE(EcsScriptConstVar);
50
51FLECS_API
52extern ECS_COMPONENT_DECLARE(EcsScriptFunction);
53
54FLECS_API
55extern ECS_COMPONENT_DECLARE(EcsScriptMethod);
56
57FLECS_API
58extern ECS_DECLARE(EcsScriptVectorType);
59
60/* Script template. */
61typedef struct ecs_script_template_t ecs_script_template_t;
62
64 typedef struct ecs_script_var_t {
65 const char *name;
66 ecs_value_t value;
67 const ecs_type_info_t *type_info;
68 int32_t sp;
69 bool is_const;
70} ecs_script_var_t;
71
73 typedef struct ecs_script_vars_t {
74 struct ecs_script_vars_t *parent;
75 int32_t sp;
76
77 ecs_hashmap_t var_index;
78 ecs_vec_t vars;
79
80 const ecs_world_t *world;
81 struct ecs_stack_t *stack;
82 ecs_stack_cursor_t *cursor;
83 ecs_allocator_t *allocator;
84} ecs_script_vars_t;
85
87 typedef struct ecs_script_t {
88 ecs_world_t *world;
89 const char *name;
90 const char *code;
91} ecs_script_t;
92
94 typedef struct ecs_script_runtime_t ecs_script_runtime_t;
95
99 typedef struct EcsScript {
100 char *filename;
101 char *code;
102 char *error;
103 ecs_script_t *script;
104 ecs_script_template_t *template_;
105} EcsScript;
106
108 typedef struct ecs_function_ctx_t {
109 ecs_world_t *world;
110 ecs_entity_t function;
111 void *ctx;
112} ecs_function_ctx_t;
113
115 typedef void(*ecs_function_callback_t)(
116 const ecs_function_ctx_t *ctx,
117 int32_t argc,
118 const ecs_value_t *argv,
119 ecs_value_t *result);
120
122 typedef void(*ecs_vector_function_callback_t)(
123 const ecs_function_ctx_t *ctx,
124 int32_t argc,
125 const ecs_value_t *argv,
126 ecs_value_t *result,
127 int32_t elem_count);
128
130 typedef struct ecs_script_parameter_t {
131 const char *name;
132 ecs_entity_t type;
133} ecs_script_parameter_t;
134
138 typedef struct EcsScriptConstVar {
139 ecs_value_t value;
140 const ecs_type_info_t *type_info;
141} EcsScriptConstVar;
142
143 struct ecs_script_function_t {
144 ecs_entity_t return_type;
145 ecs_vec_t params; /* vec<ecs_script_parameter_t> */
146 ecs_function_callback_t callback;
147 ecs_vector_function_callback_t vector_callbacks[FLECS_SCRIPT_VECTOR_FUNCTION_COUNT];
148 void *ctx;
149};
150
154 typedef struct ecs_script_function_t EcsScriptFunction;
155
161 typedef struct ecs_script_function_t EcsScriptMethod;
162
163/* Parsing and running scripts */
164
166 typedef struct ecs_script_eval_desc_t {
167 ecs_script_vars_t *vars;
168 ecs_script_runtime_t *runtime;
169} ecs_script_eval_desc_t;
170
172 typedef struct ecs_script_eval_result_t {
173 char *error;
174} ecs_script_eval_result_t;
175
195FLECS_API
196 ecs_script_t* ecs_script_parse(
197 ecs_world_t *world,
198 const char *name,
199 const char *code,
200 const ecs_script_eval_desc_t *desc,
201 ecs_script_eval_result_t *result);
202
219FLECS_API
220 int ecs_script_eval(
221 const ecs_script_t *script,
222 const ecs_script_eval_desc_t *desc,
223 ecs_script_eval_result_t *result);
224
234FLECS_API
235 void ecs_script_free(
236 ecs_script_t *script);
237
254FLECS_API
255 int ecs_script_run(
256 ecs_world_t *world,
257 const char *name,
258 const char *code,
259 ecs_script_eval_result_t *result);
260
270FLECS_API
271 int ecs_script_run_file(
272 ecs_world_t *world,
273 const char *filename);
274
288FLECS_API
289 ecs_script_runtime_t* ecs_script_runtime_new(void);
290
296FLECS_API
297 void ecs_script_runtime_free(
298 ecs_script_runtime_t *runtime);
299
309FLECS_API
310 int ecs_script_ast_to_buf(
311 ecs_script_t *script,
312 ecs_strbuf_t *buf,
313 bool colors);
314
323FLECS_API
324 char* ecs_script_ast_to_str(
325 ecs_script_t *script,
326 bool colors);
327
328
329/* Managed scripts (script associated with entity that outlives the function) */
330
332 typedef struct ecs_script_desc_t {
333 ecs_entity_t entity;
334 const char *filename;
335 const char *code;
336} ecs_script_desc_t;
337
349FLECS_API
350 ecs_entity_t ecs_script_init(
351 ecs_world_t *world,
352 const ecs_script_desc_t *desc);
353
354#define ecs_script(world, ...)\
355 ecs_script_init(world, &(ecs_script_desc_t) __VA_ARGS__)
356
365FLECS_API
366 int ecs_script_update(
367 ecs_world_t *world,
368 ecs_entity_t script,
369 ecs_entity_t instance,
370 const char *code);
371
378FLECS_API
379 void ecs_script_clear(
380 ecs_world_t *world,
381 ecs_entity_t script,
382 ecs_entity_t instance);
383
384
385/* Script variables */
386
404FLECS_API
405 ecs_script_vars_t* ecs_script_vars_init(
406 ecs_world_t *world);
407
414FLECS_API
415 void ecs_script_vars_fini(
416 ecs_script_vars_t *vars);
417
429FLECS_API
430 ecs_script_vars_t* ecs_script_vars_push(
431 ecs_script_vars_t *parent);
432
441FLECS_API
442 ecs_script_vars_t* ecs_script_vars_pop(
443 ecs_script_vars_t *vars);
444
457FLECS_API
458 ecs_script_var_t* ecs_script_vars_declare(
459 ecs_script_vars_t *vars,
460 const char *name);
461
477FLECS_API
478 ecs_script_var_t* ecs_script_vars_define_id(
479 ecs_script_vars_t *vars,
480 const char *name,
481 ecs_entity_t type);
482
483#define ecs_script_vars_define(vars, name, type)\
484 ecs_script_vars_define_id(vars, name, ecs_id(type))
485
495FLECS_API
496 ecs_script_var_t* ecs_script_vars_lookup(
497 const ecs_script_vars_t *vars,
498 const char *name);
499
512FLECS_API
513 ecs_script_var_t* ecs_script_vars_from_sp(
514 const ecs_script_vars_t *vars,
515 int32_t sp);
516
522FLECS_API
523 void ecs_script_vars_print(
524 const ecs_script_vars_t *vars);
525
534FLECS_API
535 void ecs_script_vars_set_size(
536 ecs_script_vars_t *vars,
537 int32_t count);
538
571FLECS_API
572 void ecs_script_vars_from_iter(
573 const ecs_iter_t *it,
574 ecs_script_vars_t *vars,
575 int offset);
576
577
578/* Standalone expression evaluation */
579
581 typedef struct ecs_expr_eval_desc_t {
582 const char *name;
583 const char *expr;
584 const ecs_script_vars_t *vars;
585 ecs_entity_t type;
586 ecs_entity_t (*lookup_action)(
587 const ecs_world_t*,
588 const char *value,
589 void *ctx);
590 void *lookup_ctx;
591
593 bool disable_folding;
594
598 bool disable_dynamic_variable_binding;
599
602 bool allow_unresolved_identifiers;
603
604 ecs_script_runtime_t *runtime;
605
606 void *script_visitor;
607} ecs_expr_eval_desc_t;
608
623FLECS_API
624 const char* ecs_expr_run(
625 ecs_world_t *world,
626 const char *ptr,
627 ecs_value_t *value,
628 const ecs_expr_eval_desc_t *desc);
629
639FLECS_API
640 ecs_script_t* ecs_expr_parse(
641 ecs_world_t *world,
642 const char *expr,
643 const ecs_expr_eval_desc_t *desc);
644
659FLECS_API
660 int ecs_expr_eval(
661 const ecs_script_t *script,
662 ecs_value_t *value,
663 const ecs_expr_eval_desc_t *desc);
664
678FLECS_API
679 char* ecs_script_string_interpolate(
680 ecs_world_t *world,
681 const char *str,
682 const ecs_script_vars_t *vars);
683
684
685/* Global const variables */
686
688 typedef struct ecs_const_var_desc_t {
690 const char *name;
691
693 ecs_entity_t parent;
694
696 ecs_entity_t type;
697
700 void *value;
701} ecs_const_var_desc_t;
702
709FLECS_API
710 ecs_entity_t ecs_const_var_init(
711 ecs_world_t *world,
712 ecs_const_var_desc_t *desc);
713
714#define ecs_const_var(world, ...)\
715 ecs_const_var_init(world, &(ecs_const_var_desc_t)__VA_ARGS__)
716
717
726FLECS_API
727 ecs_value_t ecs_const_var_get(
728 const ecs_world_t *world,
729 ecs_entity_t var);
730
731/* Functions */
732
734 typedef struct ecs_vector_fn_callbacks_t {
735 ecs_vector_function_callback_t i8;
736 ecs_vector_function_callback_t i32;
737} ecs_vector_fn_callbacks_t;
738
740 typedef struct ecs_function_desc_t {
742 const char *name;
743
746 ecs_entity_t parent;
747
749 ecs_script_parameter_t params[FLECS_SCRIPT_FUNCTION_ARGS_MAX];
750
752 ecs_entity_t return_type;
753
755 ecs_function_callback_t callback;
756
804 ecs_vector_function_callback_t vector_callbacks[FLECS_SCRIPT_VECTOR_FUNCTION_COUNT];
805
807 void *ctx;
808} ecs_function_desc_t;
809
817FLECS_API
818 ecs_entity_t ecs_function_init(
819 ecs_world_t *world,
820 const ecs_function_desc_t *desc);
821
822#define ecs_function(world, ...)\
823 ecs_function_init(world, &(ecs_function_desc_t)__VA_ARGS__)
824
837FLECS_API
838 ecs_entity_t ecs_method_init(
839 ecs_world_t *world,
840 const ecs_function_desc_t *desc);
841
842#define ecs_method(world, ...)\
843 ecs_method_init(world, &(ecs_function_desc_t)__VA_ARGS__)
844
845
846/* Value serialization */
847
857FLECS_API
858 char* ecs_ptr_to_expr(
859 const ecs_world_t *world,
860 ecs_entity_t type,
861 const void *data);
862
872FLECS_API
873 int ecs_ptr_to_expr_buf(
874 const ecs_world_t *world,
875 ecs_entity_t type,
876 const void *data,
877 ecs_strbuf_t *buf);
878
890FLECS_API
891 char* ecs_ptr_to_str(
892 const ecs_world_t *world,
893 ecs_entity_t type,
894 const void *data);
895
905FLECS_API
906 int ecs_ptr_to_str_buf(
907 const ecs_world_t *world,
908 ecs_entity_t type,
909 const void *data,
910 ecs_strbuf_t *buf);
911
912typedef struct ecs_expr_node_t ecs_expr_node_t;
913
922FLECS_API
923 void FlecsScriptImport(
924 ecs_world_t *world);
925
926#ifdef __cplusplus
927}
928#endif
929
930#endif
931
933
934#endif
ecs_script_runtime_free
FLECS_API void ecs_script_runtime_free(ecs_script_runtime_t *runtime)
Free script runtime.
ecs_script_eval
FLECS_API int ecs_script_eval(const ecs_script_t *script, const ecs_script_eval_desc_t *desc, ecs_script_eval_result_t *result)
Evaluate script.
ecs_script_vars_print
FLECS_API void ecs_script_vars_print(const ecs_script_vars_t *vars)
Print variables.
ecs_vector_function_callback_t
void(* ecs_vector_function_callback_t)(const ecs_function_ctx_t *ctx, int32_t argc, const ecs_value_t *argv, ecs_value_t *result, int32_t elem_count)
Script vector function callback.
Definition script.h:122
ecs_script_vars_set_size
FLECS_API void ecs_script_vars_set_size(ecs_script_vars_t *vars, int32_t count)
Preallocate space for variables.
ecs_ptr_to_expr_buf
FLECS_API int ecs_ptr_to_expr_buf(const ecs_world_t *world, ecs_entity_t type, const void *data, ecs_strbuf_t *buf)
Serialize value into expression buffer.
ecs_expr_parse
FLECS_API ecs_script_t * ecs_expr_parse(ecs_world_t *world, const char *expr, const ecs_expr_eval_desc_t *desc)
Parse expression.
ecs_script_vars_fini
FLECS_API void ecs_script_vars_fini(ecs_script_vars_t *vars)
Free variable scope.
ecs_script_runtime_new
FLECS_API ecs_script_runtime_t * ecs_script_runtime_new(void)
Create runtime for script.
ecs_ptr_to_expr
FLECS_API char * ecs_ptr_to_expr(const ecs_world_t *world, ecs_entity_t type, const void *data)
Serialize value into expression string.
ecs_function_init
FLECS_API ecs_entity_t ecs_function_init(ecs_world_t *world, const ecs_function_desc_t *desc)
Create new function.
ecs_ptr_to_str
FLECS_API char * ecs_ptr_to_str(const ecs_world_t *world, ecs_entity_t type, const void *data)
Similar to ecs_ptr_to_expr(), but serializes values to string.
EcsScriptMethod
struct ecs_script_function_t EcsScriptMethod
Method component.
Definition script.h:161
ecs_script_update
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_script_ast_to_str
FLECS_API char * ecs_script_ast_to_str(ecs_script_t *script, bool colors)
Convert script AST to string.
ecs_function_callback_t
void(* ecs_function_callback_t)(const ecs_function_ctx_t *ctx, int32_t argc, const ecs_value_t *argv, ecs_value_t *result)
Script function callback.
Definition script.h:115
ecs_script_init
FLECS_API ecs_entity_t ecs_script_init(ecs_world_t *world, const ecs_script_desc_t *desc)
Load managed script.
ecs_script_vars_pop
FLECS_API ecs_script_vars_t * ecs_script_vars_pop(ecs_script_vars_t *vars)
Pop variable scope.
ecs_script_vars_from_sp
FLECS_API ecs_script_var_t * ecs_script_vars_from_sp(const ecs_script_vars_t *vars, int32_t sp)
Lookup a variable by stack pointer.
ecs_script_clear
FLECS_API void ecs_script_clear(ecs_world_t *world, ecs_entity_t script, ecs_entity_t instance)
Clear all entities associated with script.
ecs_script_vars_declare
FLECS_API ecs_script_var_t * ecs_script_vars_declare(ecs_script_vars_t *vars, const char *name)
Declare a variable.
ecs_const_var_get
FLECS_API ecs_value_t ecs_const_var_get(const ecs_world_t *world, ecs_entity_t var)
Return the value for a const variable.
ecs_script_vars_define_id
FLECS_API ecs_script_var_t * ecs_script_vars_define_id(ecs_script_vars_t *vars, const char *name, ecs_entity_t type)
Define a variable.
EcsScriptFunction
struct ecs_script_function_t EcsScriptFunction
Function component.
Definition script.h:154
ecs_script_vars_from_iter
FLECS_API void ecs_script_vars_from_iter(const ecs_iter_t *it, ecs_script_vars_t *vars, int offset)
Convert iterator to vars.
ecs_script_free
FLECS_API void ecs_script_free(ecs_script_t *script)
Free script.
ecs_script_ast_to_buf
FLECS_API int ecs_script_ast_to_buf(ecs_script_t *script, ecs_strbuf_t *buf, bool colors)
Convert script AST to string.
ecs_method_init
FLECS_API ecs_entity_t ecs_method_init(ecs_world_t *world, const ecs_function_desc_t *desc)
Create new method.
ecs_ptr_to_str_buf
FLECS_API int ecs_ptr_to_str_buf(const ecs_world_t *world, ecs_entity_t type, const void *data, ecs_strbuf_t *buf)
Serialize value into string buffer.
ecs_script_run
FLECS_API int ecs_script_run(ecs_world_t *world, const char *name, const char *code, ecs_script_eval_result_t *result)
Parse script.
ecs_script_vars_init
FLECS_API ecs_script_vars_t * ecs_script_vars_init(ecs_world_t *world)
Create new variable scope.
ecs_expr_eval
FLECS_API int ecs_expr_eval(const ecs_script_t *script, ecs_value_t *value, const ecs_expr_eval_desc_t *desc)
Evaluate expression.
ecs_script_vars_push
FLECS_API ecs_script_vars_t * ecs_script_vars_push(ecs_script_vars_t *parent)
Push new variable scope.
ecs_script_parse
FLECS_API ecs_script_t * ecs_script_parse(ecs_world_t *world, const char *name, const char *code, const ecs_script_eval_desc_t *desc, ecs_script_eval_result_t *result)
Parse script.
ecs_script_runtime_t
struct ecs_script_runtime_t ecs_script_runtime_t
Runtime for executing scripts.
Definition script.h:94
ecs_const_var_init
FLECS_API ecs_entity_t ecs_const_var_init(ecs_world_t *world, ecs_const_var_desc_t *desc)
Create a const variable that can be accessed by scripts.
FlecsScriptImport
FLECS_API void FlecsScriptImport(ecs_world_t *world)
Script module import function.
ecs_script_string_interpolate
FLECS_API char * ecs_script_string_interpolate(ecs_world_t *world, const char *str, const ecs_script_vars_t *vars)
Evaluate interpolated expressions in string.
ecs_script_run_file
FLECS_API int ecs_script_run_file(ecs_world_t *world, const char *filename)
Parse script file.
ecs_script_vars_lookup
FLECS_API ecs_script_var_t * ecs_script_vars_lookup(const ecs_script_vars_t *vars, const char *name)
Lookup a variable.
ecs_expr_run
FLECS_API const char * ecs_expr_run(ecs_world_t *world, const char *ptr, ecs_value_t *value, const ecs_expr_eval_desc_t *desc)
Run expression.
ecs_entity_t
ecs_id_t ecs_entity_t
An entity identifier.
Definition flecs.h:381
ecs_world_t
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
Definition flecs.h:425
script
script_builder script(const char *name=nullptr) const
Build a script.
Definition mixin.inl:31
ECS_DECLARE
#define ECS_DECLARE(id)
Forward declare an entity, tag, prefab, or any other entity identifier.
Definition flecs_c.h:25
ECS_COMPONENT_DECLARE
#define ECS_COMPONENT_DECLARE(id)
Forward declare a component.
Definition flecs_c.h:112
EcsScriptConstVar
Const component.
Definition script.h:138
EcsScript
Script component.
Definition script.h:99
EcsScript::template_
ecs_script_template_t * template_
Only set for template scripts.
Definition script.h:104
EcsScript::error
char * error
Set if script evaluation had errors.
Definition script.h:102
EcsScript::code
char * code
Script source code.
Definition script.h:101
EcsScript::script
ecs_script_t * script
Parsed script object.
Definition script.h:103
EcsScript::filename
char * filename
Script filename.
Definition script.h:100
ecs_const_var_desc_t
Used with ecs_const_var_init().
Definition script.h:688
ecs_const_var_desc_t::parent
ecs_entity_t parent
Variable parent (namespace).
Definition script.h:693
ecs_const_var_desc_t::name
const char * name
Variable name.
Definition script.h:690
ecs_const_var_desc_t::type
ecs_entity_t type
Variable type.
Definition script.h:696
ecs_const_var_desc_t::value
void * value
Pointer to value of variable.
Definition script.h:700
ecs_expr_eval_desc_t
Used with ecs_expr_run().
Definition script.h:581
ecs_expr_eval_desc_t::disable_folding
bool disable_folding
Disable constant folding (slower evaluation, faster parsing).
Definition script.h:593
ecs_expr_eval_desc_t::script_visitor
void * script_visitor
For internal usage.
Definition script.h:606
ecs_expr_eval_desc_t::type
ecs_entity_t type
Type of parsed value (optional).
Definition script.h:585
ecs_expr_eval_desc_t::vars
const ecs_script_vars_t * vars
Variables accessible in expression.
Definition script.h:584
ecs_expr_eval_desc_t::runtime
ecs_script_runtime_t * runtime
Reusable runtime (optional).
Definition script.h:604
ecs_expr_eval_desc_t::allow_unresolved_identifiers
bool allow_unresolved_identifiers
Allow for unresolved identifiers when parsing.
Definition script.h:602
ecs_expr_eval_desc_t::name
const char * name
Script name.
Definition script.h:582
ecs_expr_eval_desc_t::expr
const char * expr
Full expression string.
Definition script.h:583
ecs_expr_eval_desc_t::disable_dynamic_variable_binding
bool disable_dynamic_variable_binding
This option instructs the expression runtime to lookup variables by stack pointer instead of by name,...
Definition script.h:598
ecs_expr_eval_desc_t::lookup_ctx
void * lookup_ctx
Context passed to lookup function.
Definition script.h:590
ecs_function_ctx_t
Script function context.
Definition script.h:108
ecs_function_ctx_t::ctx
void * ctx
User context.
Definition script.h:111
ecs_function_ctx_t::function
ecs_entity_t function
The function entity.
Definition script.h:110
ecs_function_ctx_t::world
ecs_world_t * world
The world.
Definition script.h:109
ecs_function_desc_t
Used with ecs_function_init() and ecs_method_init().
Definition script.h:740
ecs_function_desc_t::return_type
ecs_entity_t return_type
Function return type.
Definition script.h:752
ecs_function_desc_t::name
const char * name
Function name.
Definition script.h:742
ecs_function_desc_t::params
ecs_script_parameter_t params[(16)]
Function parameters.
Definition script.h:749
ecs_function_desc_t::ctx
void * ctx
Context passed to function implementation.
Definition script.h:807
ecs_function_desc_t::callback
ecs_function_callback_t callback
Function implementation.
Definition script.h:755
ecs_function_desc_t::vector_callbacks
ecs_vector_function_callback_t vector_callbacks[(18)]
Vector function implementations.
Definition script.h:804
ecs_function_desc_t::parent
ecs_entity_t parent
Parent of function.
Definition script.h:746
ecs_iter_t
Iterator.
Definition flecs.h:1166
ecs_script_desc_t
Used with ecs_script_init().
Definition script.h:332
ecs_script_desc_t::code
const char * code
Set to parse script from string.
Definition script.h:335
ecs_script_desc_t::entity
ecs_entity_t entity
Set to customize entity handle associated with script.
Definition script.h:333
ecs_script_desc_t::filename
const char * filename
Set to load script from file.
Definition script.h:334
ecs_script_eval_desc_t
Used with ecs_script_parse() and ecs_script_eval().
Definition script.h:166
ecs_script_eval_desc_t::runtime
ecs_script_runtime_t * runtime
Reusable runtime (optional).
Definition script.h:168
ecs_script_eval_desc_t::vars
ecs_script_vars_t * vars
Variables used by script.
Definition script.h:167
ecs_script_eval_result_t
Used to capture error output from script evaluation.
Definition script.h:172
ecs_script_eval_result_t::error
char * error
Error message, or NULL if no error.
Definition script.h:173
ecs_script_function_t
Definition script.h:143
ecs_script_parameter_t
Function argument type.
Definition script.h:130
ecs_script_parameter_t::name
const char * name
Parameter name.
Definition script.h:131
ecs_script_parameter_t::type
ecs_entity_t type
Parameter type.
Definition script.h:132
ecs_script_t
Script object.
Definition script.h:87
ecs_script_t::code
const char * code
Script source code.
Definition script.h:90
ecs_script_t::name
const char * name
Script name.
Definition script.h:89
ecs_script_t::world
ecs_world_t * world
The world.
Definition script.h:88
ecs_script_var_t
Script variable.
Definition script.h:64
ecs_script_var_t::is_const
bool is_const
Whether the variable is constant.
Definition script.h:69
ecs_script_var_t::value
ecs_value_t value
Variable value.
Definition script.h:66
ecs_script_var_t::name
const char * name
Variable name.
Definition script.h:65
ecs_script_var_t::type_info
const ecs_type_info_t * type_info
Type information.
Definition script.h:67
ecs_script_var_t::sp
int32_t sp
Stack pointer.
Definition script.h:68
ecs_script_vars_t
Script variable scope.
Definition script.h:73
ecs_script_vars_t::sp
int32_t sp
Stack pointer for this scope.
Definition script.h:75
ecs_script_vars_t::allocator
ecs_allocator_t * allocator
General purpose allocator.
Definition script.h:83
ecs_script_vars_t::parent
struct ecs_script_vars_t * parent
Parent variable scope.
Definition script.h:74
ecs_script_vars_t::stack
struct ecs_stack_t * stack
Stack allocator for variable storage.
Definition script.h:81
ecs_script_vars_t::cursor
ecs_stack_cursor_t * cursor
Cursor into the stack allocator.
Definition script.h:82
ecs_script_vars_t::var_index
ecs_hashmap_t var_index
Index for variable name lookups.
Definition script.h:77
ecs_script_vars_t::world
const ecs_world_t * world
The world.
Definition script.h:80
ecs_script_vars_t::vars
ecs_vec_t vars
Vector of variables in this scope.
Definition script.h:78
ecs_type_info_t
Type that contains component information (passed to ctors/dtors/...).
Definition flecs.h:1019
ecs_value_t
Utility to hold a value of a dynamic type.
Definition flecs.h:1033
ecs_vector_fn_callbacks_t
Vector function callbacks for different element types.
Definition script.h:734
ecs_vector_fn_callbacks_t::i8
ecs_vector_function_callback_t i8
Callback for i8 element type.
Definition script.h:735
ecs_vector_fn_callbacks_t::i32
ecs_vector_function_callback_t i32
Callback for i32 element type.
Definition script.h:736