Skip to content

Fix error in simple_spawner.gd with Godot 4.2.2#242

Merged
starnight merged 1 commit intomainfrom
godot-4-2-compatibility
Oct 2, 2024
Merged

Fix error in simple_spawner.gd with Godot 4.2.2#242
starnight merged 1 commit intomainfrom
godot-4-2-compatibility

Conversation

@dylanmccall
Copy link
Copy Markdown
Contributor

With Godot 4.3, it is possible to use is_instance_valid as a Callable. To support Godot 4.2.2, we must use an anonymous function instead.

With Godot 4.3, it is possible to use is_instance_valid as a Callable.
To support Godot 4.2.2, we must use an anonymous function instead.
return

_spawned_scenes = _spawned_scenes.filter(is_instance_valid)
_spawned_scenes = _spawned_scenes.filter(func(instance): return is_instance_valid(instance))
Copy link
Copy Markdown
Contributor

@starnight starnight Oct 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I try to understand the func() and instance. Then, I found it is Godot 4 lambda functions.

@starnight starnight merged commit 22c0777 into main Oct 2, 2024
@starnight starnight deleted the godot-4-2-compatibility branch October 2, 2024 04:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants