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

IsA, ClassName & Parent should work if an instance is already destroyed #271

Merged
merged 2 commits into from
Nov 5, 2024

Conversation

sasial-dev
Copy link
Contributor

@sasial-dev sasial-dev commented Nov 2, 2024

Initially from how the following errors:

print("Removing scripts...")
for _,v in place:GetService("Workspace"):GetDescendants() do
    if v:IsA("LuaSourceContainer") then
        v:Destroy()
    end
end

I tried to get name to work as well but I couldn't unless we add a field to the Instance struct.
I also tested the other methods to see if I could remove the ensure_not_destroyed requirement but I couldn't. It might be worth documenting that lune is different to Roblox where:

local p = Instance.new("Part");
p:Destroy();
print(p:GetChildren())

returns {}

This also introduces the fact that v.Parent can = nil which is useful in telling if an Instance is destroyed.

Copy link
Collaborator

@filiptibell filiptibell left a comment

Choose a reason for hiding this comment

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

Nice, yeah we should definitely try to be as close to Roblox behavior as possible and erroring on these was overly cautious. LGTM!

@filiptibell filiptibell merged commit 91af86c into lune-org:main Nov 5, 2024
6 checks passed
@sasial-dev sasial-dev deleted the fix-destroyed-check branch November 6, 2024 05:30
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