summaryrefslogtreecommitdiff
path: root/core/extension/gdnative_interface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/extension/gdnative_interface.cpp')
-rw-r--r--core/extension/gdnative_interface.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/core/extension/gdnative_interface.cpp b/core/extension/gdnative_interface.cpp
index 77229a784d..b41f74a4bc 100644
--- a/core/extension/gdnative_interface.cpp
+++ b/core/extension/gdnative_interface.cpp
@@ -771,6 +771,18 @@ static GDNativeTypePtr gdnative_packed_vector3_array_operator_index_const(const
return (GDNativeTypePtr)&self->ptr()[p_index];
}
+static GDNativeVariantPtr gdnative_array_operator_index(GDNativeTypePtr p_self, GDNativeInt p_index) {
+ Array *self = (Array *)p_self;
+ ERR_FAIL_INDEX_V(p_index, self->size(), nullptr);
+ return (GDNativeTypePtr)&self[p_index];
+}
+
+static GDNativeVariantPtr gdnative_array_operator_index_const(const GDNativeTypePtr p_self, GDNativeInt p_index) {
+ const Array *self = (const Array *)p_self;
+ ERR_FAIL_INDEX_V(p_index, self->size(), nullptr);
+ return (GDNativeTypePtr)&self[p_index];
+}
+
/* OBJECT API */
static void gdnative_object_method_bind_call(const GDNativeMethodBindPtr p_method_bind, GDNativeObjectPtr p_instance, const GDNativeVariantPtr *p_args, GDNativeInt p_arg_count, GDNativeVariantPtr r_return, GDNativeCallError *r_error) {
@@ -979,6 +991,9 @@ void gdnative_setup_interface(GDNativeInterface *p_interface) {
gdni.packed_vector3_array_operator_index = gdnative_packed_vector3_array_operator_index;
gdni.packed_vector3_array_operator_index_const = gdnative_packed_vector3_array_operator_index_const;
+ gdni.array_operator_index = gdnative_array_operator_index;
+ gdni.array_operator_index_const = gdnative_array_operator_index_const;
+
/* OBJECT */
gdni.object_method_bind_call = gdnative_object_method_bind_call;