Skip to main content

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: boolean

A boolean representing if the current function is running

Priority

This item is read only and cannot be modified. Read Only
since v1.4.0
</>
QueuePrompt.Priority: number

The queue's priority.

Functions

SetPriority

since 1.4.0
</>
QueuePrompt:SetPriority(Valuenumber) → QueuePrompt

Sets the queue priority. When a queue goes to the next prompt, it'll pick the one with the highest Priority.

Timeout

QueuePrompt:Timeout(timenumber) → QueuePrompt

Disconnects the function after a given amount of time

Destroy

QueuePrompt:Destroy() → ()

Disconnects the function immediately

Show raw api
{
    "functions": [
        {
            "name": "SetPriority",
            "desc": "Sets the queue priority. When a queue goes to the next prompt, it'll pick the one with the highest Priority.",
            "params": [
                {
                    "name": "Value",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "QueuePrompt\r\n"
                }
            ],
            "function_type": "method",
            "since": "1.4.0",
            "source": {
                "line": 90,
                "path": "src/Queue/init.luau"
            }
        },
        {
            "name": "Timeout",
            "desc": "Disconnects the function after a given amount of time\t",
            "params": [
                {
                    "name": "time",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "QueuePrompt\r\n"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 121,
                "path": "src/Queue/init.luau"
            }
        },
        {
            "name": "Destroy",
            "desc": "Disconnects the function immediately",
            "params": [],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 160,
                "path": "src/Queue/init.luau"
            }
        }
    ],
    "properties": [
        {
            "name": "Running",
            "desc": "A boolean representing if the current function is running",
            "lua_type": "boolean",
            "since": "v1.4.0",
            "source": {
                "line": 136,
                "path": "src/Queue/init.luau"
            }
        },
        {
            "name": "Priority",
            "desc": "The queue's priority.",
            "lua_type": "number",
            "since": "v1.4.0",
            "readonly": true,
            "source": {
                "line": 145,
                "path": "src/Queue/init.luau"
            }
        }
    ],
    "types": [],
    "name": "QueuePrompt",
    "desc": "This is what's returned from the Queue:Add() method. It can be used to add timeouts to the added function\nor cancel it.\n\nBasic Usage:\n```lua\nlocal Queue = require(Path.to.Queue)\n\nlocal QueueClass = Queue.new()\n\nQueueClass:Add(task.wait, 5)\n\nlocal Prompt = QueueClass:Add(function()\n\tprint(\"Ran\")\nend):Timeout(1)\n\n-- \"Ran\" never gets printed because while the first function yields for 5 seconds,\n-- the second gets removed after 1 second\n\n-- it can also be manually disconnected with :Destroy()\n\ntask.wait(0.5)\n\nPrompt:Destroy()\n```",
    "since": "v1.2.0",
    "source": {
        "line": 82,
        "path": "src/Queue/init.luau"
    }
}