-
-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Using method name without class fails to create static callable #86032
Copy link
Copy link
Closed
Labels
Milestone
Description
Godot version
v4.2.stable.official [46dc277]
Using external editor Visual Code.
System information
Windows 11
Issue description
I preload a script from a @tool script where i try to call a static from another static function.
Resulting error:
res://non_tool.gd:8 - Invalid get index 'compare_ascending' (on base: 'Nil').
Steps to reproduce
Minimal example attached.
Code used:
non_tool.gd
extends RefCounted
static func compare_ascending(lhs: String, rhs: String) -> bool:
return lhs < rhs
static func get_engine_components() -> Array[String]:
var engine_components: Array[String] = ["b", "c", "foo", "d"]
engine_components.sort_custom(compare_ascending)
return engine_components
Control.gd
@toolcan also be removed and is not required for it to fail.
@tool
extends Control
const NonTool := preload("non_tool.gd")
func _init():
print(NonTool.get_engine_components())
Minimal reproduction project
Reactions are currently unavailable