Skip to content

Commit 5f3d287

Browse files
committed
Godot 4.2 compatibility
Renames call() to invoke_call() to avoid "The function signature doesn't match the parent" errors. Since gdscript doesn't support function overloading, classes can no longer have a method named "call" because the Object class has one.
1 parent 33330e8 commit 5f3d287

File tree

9 files changed

+15
-16
lines changed

9 files changed

+15
-16
lines changed

addons/quentincaffeino/array-utils/src/Collection.gd

+2-2
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ func fill(value = null, startIndex = 0, length = null):
195195
# @returns Collection
196196
func map(callback):
197197
for key in self:
198-
self._collection[key] = callback.call([self._collection[key], key, self._collection])
198+
self._collection[key] = callback.invoke_call([self._collection[key], key, self._collection])
199199

200200
self.first()
201201
return self
@@ -214,7 +214,7 @@ func filter(callback = null):
214214
var key = new_collection.get_keys()[i]
215215
var value = new_collection.get(key)
216216

217-
call = callback.call([key, value, i, new_collection])
217+
call = callback.invoke_call([key, value, i, new_collection])
218218

219219
if !call:
220220
new_collection.remove_by_index(i)

addons/quentincaffeino/callback/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ func _ready(): # void
2222
var func_cb = CallbackBuilder.new(self).set_name("callable_function").build()
2323
var funcref_cb = CallbackBuilder.new(funcref(self, "callable_function")).build()
2424
25-
print(prop_cb.call()) # Prints: Hello world!
25+
print(prop_cb.invoke_call()) # Prints: Hello world!
2626
27-
print(func_cb.call(["Hello, sam!"])) # Prints: [Reference...]
28-
print(prop_cb.call()) # Prints: Hello, sam!
27+
print(func_cb.invoke_call(["Hello, sam!"])) # Prints: [Reference...]
28+
print(prop_cb.invoke_call()) # Prints: Hello, sam!
2929
30-
print(funcref_cb.call(["Hello, peter!"])) # Prints: [Reference...]
31-
print(prop_cb.call()) # Prints: Hello, peter!
30+
print(funcref_cb.invoke_call(["Hello, peter!"])) # Prints: [Reference...]
31+
print(prop_cb.invoke_call()) # Prints: Hello, peter!
3232
```
3333

3434
## License

addons/quentincaffeino/callback/src/AbstractCallback.gd

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func bind(argv = []):
4848

4949
# @param Variant[] argv
5050
# @returns Variant
51-
func call(argv = []):
51+
func invoke_call(argv = []):
5252
pass
5353

5454

addons/quentincaffeino/callback/src/CallableCallback.gd

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ func ensure():
1515

1616
# @param Variant[] argv
1717
# @returns Variant
18-
func call(argv = []):
18+
func invoke_call(argv = []):
1919
# Ensure callback target still exists
2020
if !ensure():
2121
print(errors["qc.callback.call.ensure_failed"] % [ self._target ])
2222
return
2323

2424
# Execute call
25-
return self._target.call(self._get_args(argv))
25+
return self._target.invoke_call(self._get_args(argv))

addons/quentincaffeino/callback/src/Callback.gd

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
extends "./AbstractCallback.gd"
32

43

@@ -40,7 +39,7 @@ func ensure():
4039

4140
# @param Variant[] argv
4241
# @returns Variant
43-
func call(argv = []):
42+
func invoke_call(argv = []):
4443
# Ensure callback target still exists
4544
if !ensure():
4645
print(errors["qc.callback.call.ensure_failed"] % [ self._target, self._name ])

addons/quentincaffeino/console/docs/generated/AbstractCallback.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void
5858
### call
5959

6060
```gdscript
61-
func call(argv: Variant[])
61+
func invoke_call(argv: Variant[])
6262
```
6363

6464
Variant

addons/quentincaffeino/console/docs/generated/Callback.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ boolean
3434
### call
3535

3636
```gdscript
37-
func call(argv: Variant[])
37+
func invoke_call(argv: Variant[])
3838
```
3939

4040
Variant

addons/quentincaffeino/console/docs/generated/FuncRefCallback.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ boolean
2626
### call
2727

2828
```gdscript
29-
func call(argv: Variant[])
29+
func invoke_call(argv: Variant[])
3030
```
3131

3232
Variant

addons/quentincaffeino/console/src/Command/Command.gd

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func execute(inArgs = []):
6969
i += 1
7070

7171
# Execute command
72-
return self._target.call(args)
72+
return self._target.invoke_call(args)
7373

7474

7575
# @returns void

0 commit comments

Comments
 (0)