Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleitnick committed Apr 24, 2023
1 parent 73bfe4a commit d851215
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/observeTag.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ function observeTag<T>(tag: string, callback: (instance: T) -> () -> (), ancesto
end

-- Run the callback in protected mode:
local success, cleanup = xpcall(function(instance: T)
local cleanup = callback(instance)
assert(typeof(cleanup) == "function", "callback must return a function")
return cleanup
local success, cleanup = xpcall(function(inst: T)
local clean = callback(inst)
assert(typeof(clean) == "function", "callback must return a function")
return clean
end, debug.traceback, instance :: any)

-- If callback errored, print out the traceback:
Expand Down Expand Up @@ -149,7 +149,7 @@ function observeTag<T>(tag: string, callback: (instance: T) -> () -> (), ancesto

instances[instance] = "__dead__"

ancestryConn[instance] = instance.AncestryChanged:Connect(function(_, parent)
ancestryConn[instance] = instance.AncestryChanged:Connect(function()
OnAncestryChanged(instance)
end)
OnAncestryChanged(instance)
Expand Down

0 comments on commit d851215

Please sign in to comment.