Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Godot 4.2 / .net6 port #108

Open
wants to merge 3 commits into
base: godot4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
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.
  • Loading branch information
Treer committed Jan 21, 2024
commit a7d92329ec3957c5734a58b9f851b4af36b91c48
4 changes: 2 additions & 2 deletions addons/quentincaffeino/array-utils/src/Collection.gd
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func fill(value = null, startIndex = 0, length = null):
# @returns Collection
func map(callback):
for key in self:
self._collection[key] = callback.call([self._collection[key], key, self._collection])
self._collection[key] = callback.invoke_call([self._collection[key], key, self._collection])

self.first()
return self
Expand All @@ -214,7 +214,7 @@ func filter(callback = null):
var key = new_collection.get_keys()[i]
var value = new_collection.get(key)

call = callback.call([key, value, i, new_collection])
call = callback.invoke_call([key, value, i, new_collection])

if !call:
new_collection.remove_by_index(i)
Expand Down
10 changes: 5 additions & 5 deletions addons/quentincaffeino/callback/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ func _ready(): # void
var func_cb = CallbackBuilder.new(self).set_name("callable_function").build()
var funcref_cb = CallbackBuilder.new(funcref(self, "callable_function")).build()

print(prop_cb.call()) # Prints: Hello world!
print(prop_cb.invoke_call()) # Prints: Hello world!

print(func_cb.call(["Hello, sam!"])) # Prints: [Reference...]
print(prop_cb.call()) # Prints: Hello, sam!
print(func_cb.invoke_call(["Hello, sam!"])) # Prints: [Reference...]
print(prop_cb.invoke_call()) # Prints: Hello, sam!

print(funcref_cb.call(["Hello, peter!"])) # Prints: [Reference...]
print(prop_cb.call()) # Prints: Hello, peter!
print(funcref_cb.invoke_call(["Hello, peter!"])) # Prints: [Reference...]
print(prop_cb.invoke_call()) # Prints: Hello, peter!
```

## License
Expand Down
2 changes: 1 addition & 1 deletion addons/quentincaffeino/callback/src/AbstractCallback.gd
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func bind(argv = []):

# @param Variant[] argv
# @returns Variant
func call(argv = []):
func invoke_call(argv = []):
pass


Expand Down
2 changes: 1 addition & 1 deletion addons/quentincaffeino/callback/src/CallableCallback.gd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func ensure():

# @param Variant[] argv
# @returns Variant
func call(argv = []):
func invoke_call(argv = []):
# Ensure callback target still exists
if !ensure():
print(errors["qc.callback.call.ensure_failed"] % [ self._target ])
Expand Down
3 changes: 1 addition & 2 deletions addons/quentincaffeino/callback/src/Callback.gd
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

extends "./AbstractCallback.gd"


Expand Down Expand Up @@ -40,7 +39,7 @@ func ensure():

# @param Variant[] argv
# @returns Variant
func call(argv = []):
func invoke_call(argv = []):
# Ensure callback target still exists
if !ensure():
print(errors["qc.callback.call.ensure_failed"] % [ self._target, self._name ])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void
### call

```gdscript
func call(argv: Variant[])
func invoke_call(argv: Variant[])
```

Variant
2 changes: 1 addition & 1 deletion addons/quentincaffeino/console/docs/generated/Callback.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ boolean
### call

```gdscript
func call(argv: Variant[])
func invoke_call(argv: Variant[])
```

Variant
2 changes: 1 addition & 1 deletion addons/quentincaffeino/console/src/Command/Command.gd
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func execute(inArgs = []):
i += 1

# Execute command
return self._target.call(args)
return self._target.invoke_call(args)


# @returns void
Expand Down