|
@@ -148,6 +148,7 @@ void Example::_bind_methods() {
|
|
ClassDB::bind_method(D_METHOD("test_str_utility"), &Example::test_str_utility);
|
|
ClassDB::bind_method(D_METHOD("test_str_utility"), &Example::test_str_utility);
|
|
ClassDB::bind_method(D_METHOD("test_string_is_fourty_two"), &Example::test_string_is_fourty_two);
|
|
ClassDB::bind_method(D_METHOD("test_string_is_fourty_two"), &Example::test_string_is_fourty_two);
|
|
ClassDB::bind_method(D_METHOD("test_vector_ops"), &Example::test_vector_ops);
|
|
ClassDB::bind_method(D_METHOD("test_vector_ops"), &Example::test_vector_ops);
|
|
|
|
+ ClassDB::bind_method(D_METHOD("test_vector_init_list"), &Example::test_vector_init_list);
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("test_object_cast_to_node", "object"), &Example::test_object_cast_to_node);
|
|
ClassDB::bind_method(D_METHOD("test_object_cast_to_node", "object"), &Example::test_object_cast_to_node);
|
|
ClassDB::bind_method(D_METHOD("test_object_cast_to_control", "object"), &Example::test_object_cast_to_control);
|
|
ClassDB::bind_method(D_METHOD("test_object_cast_to_control", "object"), &Example::test_object_cast_to_control);
|
|
@@ -339,6 +340,15 @@ int Example::test_vector_ops() const {
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+int Example::test_vector_init_list() const {
|
|
|
|
+ PackedInt32Array arr = { 10, 20, 30, 45 };
|
|
|
|
+ int ret = 0;
|
|
|
|
+ for (const int32_t &E : arr) {
|
|
|
|
+ ret += E;
|
|
|
|
+ }
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
int Example::test_tarray_arg(const TypedArray<int64_t> &p_array) {
|
|
int Example::test_tarray_arg(const TypedArray<int64_t> &p_array) {
|
|
int sum = 0;
|
|
int sum = 0;
|
|
for (int i = 0; i < p_array.size(); i++) {
|
|
for (int i = 0; i < p_array.size(); i++) {
|