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

GDScript: no parser error when invalid preload() used #40864

Closed
ThakeeNathees opened this issue Jul 30, 2020 · 1 comment
Closed

GDScript: no parser error when invalid preload() used #40864

ThakeeNathees opened this issue Jul 30, 2020 · 1 comment

Comments

@ThakeeNathees
Copy link
Contributor

ThakeeNathees commented Jul 30, 2020

Godot version: v4.0.dev.custom_build 5ba46dd

OS/device including version: windows 10

Issue description:
preloading the current script doesn't show any errors.

extends Node2D
## current script path = res://Node2D.gd
var s = preload("res://Node2D.gd")
@Calinou Calinou added this to the 4.0 milestone Jul 30, 2020
@YuriSizov YuriSizov modified the milestones: 4.0, 4.1 Feb 23, 2023
@adamscott
Copy link
Member

Since #67714, it's actually a feature. A script can preload itself, then compare the type.
So this code works:

# res://A.gd
var SelfClass: = preload("res://A.gd")

func _ready() -> void:
    print(is_instance_of(self, SelfClass))  # true

@akien-mga akien-mga modified the milestones: 4.1, 4.0 Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants