summaryrefslogtreecommitdiff
path: root/modules/dlscript/godot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/dlscript/godot.cpp')
-rw-r--r--modules/dlscript/godot.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/modules/dlscript/godot.cpp b/modules/dlscript/godot.cpp
index e987e8cf18..9a488ad612 100644
--- a/modules/dlscript/godot.cpp
+++ b/modules/dlscript/godot.cpp
@@ -28,16 +28,11 @@
/*************************************************************************/
#include "godot.h"
-#include <cassert>
-#include <cstdlib>
-
#include "class_db.h"
#include "dl_script.h"
#include "global_config.h"
#include "variant.h"
-#include <memory.h>
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -175,6 +170,16 @@ void GDAPI godot_script_register_signal(const char *p_name, const godot_signal *
library->_register_script_signal(p_name, p_signal);
}
+void GDAPI *godot_dlinstance_get_userdata(godot_object *p_instance) {
+ Object *instance = (Object *)p_instance;
+ if (!instance)
+ return NULL;
+ if (instance->get_script_instance() && instance->get_script_instance()->get_language() == DLScriptLanguage::get_singleton()) {
+ return ((DLInstance *)instance->get_script_instance())->get_userdata();
+ }
+ return NULL;
+}
+
// System functions
void GDAPI *godot_alloc(int p_bytes) {
return memalloc(p_bytes);