diff options
Diffstat (limited to 'modules/dlscript/godot.cpp')
-rw-r--r-- | modules/dlscript/godot.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/dlscript/godot.cpp b/modules/dlscript/godot.cpp index 478eb86c08..623f7f0149 100644 --- a/modules/dlscript/godot.cpp +++ b/modules/dlscript/godot.cpp @@ -32,6 +32,7 @@ #include "class_db.h" #include "dl_script.h" #include "global_config.h" +#include "global_constants.h" #include "variant.h" #ifdef __cplusplus @@ -181,6 +182,19 @@ void GDAPI *godot_dlinstance_get_userdata(godot_object *p_instance) { return NULL; } +godot_dictionary GDAPI godot_get_global_constants() { + godot_dictionary constants; + godot_dictionary_new(&constants); + Dictionary *p_constants = (Dictionary*)&constants; + const int constants_count = GlobalConstants::get_global_constant_count(); + for (int i = 0; i < constants_count; ++i) { + const char *name = GlobalConstants::get_global_constant_name(i); + int value = GlobalConstants::get_global_constant_value(i); + (*p_constants)[name] = value; + } + return constants; +} + // System functions void GDAPI *godot_alloc(int p_bytes) { return memalloc(p_bytes); |