Skip to main content

MaidTaskUtils

Utility methods involving maids and tasks.

Types

Destructable

type Destructable = Instance | {Destroyfunction}

An object that can have the method :Destroy() called on it

MaidTask

type MaidTask = function | thread | Destructable | RBXScriptConnection

An object that can be cleaned up

Functions

isValidTask

MaidTaskUtils.isValidTask(jobany) → boolean

Returns whether a task is a valid job.

doTask

MaidTaskUtils.doTask(
jobMaidTask--

Task to execute

) → ()

Executes the task as requested.

delayed

MaidTaskUtils.delayed(
timenumber,--

Time in seconds

jobMaidTask--

Job to delay execution

) → () → ()--

function that will execute the job delayed

Executes the task delayed after some time.

-- delays cleanup by 5 seconds
maid:GiveTask(MaidTaskUtils.delayed(5, gui))
Show raw api
{
    "functions": [
        {
            "name": "isValidTask",
            "desc": "Returns whether a task is a valid job.",
            "params": [
                {
                    "name": "job",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 25,
                "path": "src/maid/src/Shared/MaidTaskUtils.lua"
            }
        },
        {
            "name": "doTask",
            "desc": "Executes the task as requested.",
            "params": [
                {
                    "name": "job",
                    "desc": "Task to execute",
                    "lua_type": "MaidTask"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 38,
                "path": "src/maid/src/Shared/MaidTaskUtils.lua"
            }
        },
        {
            "name": "delayed",
            "desc": "Executes the task delayed after some time.\n\n```lua\n-- delays cleanup by 5 seconds\nmaid:GiveTask(MaidTaskUtils.delayed(5, gui))\n```",
            "params": [
                {
                    "name": "time",
                    "desc": "Time in seconds",
                    "lua_type": "number"
                },
                {
                    "name": "job",
                    "desc": "Job to delay execution",
                    "lua_type": "MaidTask"
                }
            ],
            "returns": [
                {
                    "desc": "function that will execute the job delayed",
                    "lua_type": "() -> ()"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 78,
                "path": "src/maid/src/Shared/MaidTaskUtils.lua"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "Destructable",
            "desc": "An object that can have the method :Destroy() called on it",
            "lua_type": "Instance | { Destroy: function }",
            "source": {
                "line": 11,
                "path": "src/maid/src/Shared/MaidTaskUtils.lua"
            }
        },
        {
            "name": "MaidTask",
            "desc": "An object that can be cleaned up",
            "lua_type": "function | thread | Destructable | RBXScriptConnection",
            "source": {
                "line": 17,
                "path": "src/maid/src/Shared/MaidTaskUtils.lua"
            }
        }
    ],
    "name": "MaidTaskUtils",
    "desc": "Utility methods involving maids and tasks.",
    "source": {
        "line": 5,
        "path": "src/maid/src/Shared/MaidTaskUtils.lua"
    }
}