Make root() destroy scope if error occurs

This commit is contained in:
aaron 2024-10-06 18:14:53 +01:00
parent c4e1396684
commit 93a2a2c631
2 changed files with 2 additions and 1 deletions

View file

@ -29,7 +29,7 @@ local function root<T...>(fn: (destroy: () -> ()) -> T...): (() -> (), T...)
pop_scope()
if not result[1] then
refs[node] = nil
destroy()
throw(`error while running root():\n\n{result[2]}`)
end