QueuePrompt
This is what's returned from the Queue:Add() method. It can be used to add timeouts to the added function or cancel it.
Basic Usage:
local Queue = require(Path.to.Queue)
local QueueClass = Queue.new()
QueueClass:Add(task.wait, 5)
local Prompt = QueueClass:Add(function()
print("Ran")
end):Timeout(1)
-- "Ran" never gets printed because while the first function yields for 5 seconds,
-- the second gets removed after 1 second
-- it can also be manually disconnected with :Destroy()
task.wait(0.5)
Prompt:Destroy()
Properties
Running
since v1.4.0
</>
QueuePrompt.Running: booleanA boolean representing if the current function is running
Priority
This item is read only and cannot be modified. Read Onlysince v1.4.0
</>
QueuePrompt.Priority: numberThe queue's priority.
Functions
SetPriority
since 1.4.0
</>
Sets the queue priority. When a queue goes to the next prompt, it'll pick the one with the highest Priority.
Timeout
Disconnects the function after a given amount of time
Destroy
QueuePrompt:Destroy() → ()Disconnects the function immediately