getreg
Returns the Luau registry table used internally by the VM.
function getreg(): { [any]: any }{ [any]: any }The Luau registry table containing all VM-registered object references.Usage
Find and cancel a running coroutine from the registry
local my_thread = task.spawn(function()
while task.wait(1) do print("tick") end
end)
task.wait(0.1)
for _, v in pairs(getreg()) do
if v == my_thread then
task.cancel(v)
print("Thread found and cancelled")
break
end
end