diff options
author | Juan Linietsky <reduzio@gmail.com> | 2018-05-14 17:59:34 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-14 17:59:34 -0300 |
commit | 47d4a011d8cacbdf95f9cae6d29db1f4dc1de734 (patch) | |
tree | 6f2376ca997b9899f37f5d25aa30d515cdd91d98 /modules/gdscript/gdscript_function.cpp | |
parent | 92f1debf0824f8eb8e2e38450dc34542be079375 (diff) | |
parent | decf178033d4176b0955b8efa8a081f7bccd7ed1 (diff) | |
download | redot-engine-47d4a011d8cacbdf95f9cae6d29db1f4dc1de734.tar.gz |
Merge pull request #18545 from vnen/editor-autoload
Enable autoload in editor
Diffstat (limited to 'modules/gdscript/gdscript_function.cpp')
-rw-r--r-- | modules/gdscript/gdscript_function.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_function.cpp b/modules/gdscript/gdscript_function.cpp index 1c5b8187ca..dac7da3a28 100644 --- a/modules/gdscript/gdscript_function.cpp +++ b/modules/gdscript/gdscript_function.cpp @@ -108,6 +108,21 @@ Variant *GDScriptFunction::_get_variant(int p_address, GDScriptInstance *p_insta #endif return &GDScriptLanguage::get_singleton()->get_global_array()[address]; } break; +#ifdef TOOLS_ENABLED + case ADDR_TYPE_NAMED_GLOBAL: { +#ifdef DEBUG_ENABLED + ERR_FAIL_INDEX_V(address, _named_globals_count, NULL); +#endif + StringName id = _named_globals_ptr[address]; + + if (GDScriptLanguage::get_singleton()->get_named_globals_map().has(id)) { + return (Variant *)&GDScriptLanguage::get_singleton()->get_named_globals_map()[id]; + } else { + r_error = "Autoload singleton '" + String(id) + "' has been removed."; + return NULL; + } + } break; +#endif case ADDR_TYPE_NIL: { return &nil; } break; |