Skip to main content

UndoStack

Functions

ClearRedoStack

UndoStack:ClearRedoStack() → boolean

Clears the redo stack manually. This may be required if you do an action but can't push an undo.

IsActionExecuting

UndoStack:IsActionExecuting() → boolean

Returns true if an action is executing

ObserveHasUndoEntries

UndoStack:ObserveHasUndoEntries() → Observable<boolean>

Observes whether the stack has undo entries

ObserveHasRedoEntries

UndoStack:ObserveHasRedoEntries() → Observable<boolean>

Observes whether the stack has redo entries

HasUndoEntries

UndoStack:HasUndoEntries() → boolean

Returns true if there are undo entries on the stack

HasRedoEntries

UndoStack:HasRedoEntries() → boolean

Returns true if there are redo entries on the stack

Push

UndoStack:Push(undoStackEntryUndoStackEntry) → function--

Callback that removes the action

Pushes an action to be undone.

local entry = UndoStackEntry.new()
entry:SetPromiseUndo(function()
	return buildService:PromiseSellItem(item)
end)
entry:SetPromiseRedo(function()
	return buildService:PromisePlaceItem(item)
end)

maid:GiveTask(undoStack:Push(entry))

Remove

UndoStack:Remove(undoStackEntryTheundostackentrytoremove) → ()

Removes the action specified from the stack entirely. If the action was queued to run, it may still run.

PromiseUndo

UndoStack:PromiseUndo() → Promise

Undoes from the stack. If a current action is going on, it will finish running.

PromiseRedo

UndoStack:PromiseRedo() → Promise

Redoes the from the stack. If a current action is going on, it will be queued.

Show raw api
{
    "functions": [
        {
            "name": "ClearRedoStack",
            "desc": "Clears the redo stack manually. This may be required if you do an action but\ncan't push an undo.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 41,
                "path": "src/undostack/src/Shared/UndoStack.lua"
            }
        },
        {
            "name": "IsActionExecuting",
            "desc": "Returns true if an action is executing",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 50,
                "path": "src/undostack/src/Shared/UndoStack.lua"
            }
        },
        {
            "name": "ObserveHasUndoEntries",
            "desc": "Observes whether the stack has undo entries",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<boolean>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 58,
                "path": "src/undostack/src/Shared/UndoStack.lua"
            }
        },
        {
            "name": "ObserveHasRedoEntries",
            "desc": "Observes whether the stack has redo entries",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<boolean>"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 66,
                "path": "src/undostack/src/Shared/UndoStack.lua"
            }
        },
        {
            "name": "HasUndoEntries",
            "desc": "Returns true if there are undo entries on the stack",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 74,
                "path": "src/undostack/src/Shared/UndoStack.lua"
            }
        },
        {
            "name": "HasRedoEntries",
            "desc": "Returns true if there are redo entries on the stack",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 82,
                "path": "src/undostack/src/Shared/UndoStack.lua"
            }
        },
        {
            "name": "Push",
            "desc": "Pushes an action to be undone.\n\n```lua\nlocal entry = UndoStackEntry.new()\nentry:SetPromiseUndo(function()\n\treturn buildService:PromiseSellItem(item)\nend)\nentry:SetPromiseRedo(function()\n\treturn buildService:PromisePlaceItem(item)\nend)\n\nmaid:GiveTask(undoStack:Push(entry))\n```",
            "params": [
                {
                    "name": "undoStackEntry",
                    "desc": "",
                    "lua_type": "UndoStackEntry"
                }
            ],
            "returns": [
                {
                    "desc": "Callback that removes the action",
                    "lua_type": "function"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 104,
                "path": "src/undostack/src/Shared/UndoStack.lua"
            }
        },
        {
            "name": "Remove",
            "desc": "Removes the action specified from the stack entirely. If the action was queued to run,\nit may still run.",
            "params": [
                {
                    "name": "undoStackEntry",
                    "desc": "",
                    "lua_type": "The undo stack entry to remove"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 145,
                "path": "src/undostack/src/Shared/UndoStack.lua"
            }
        },
        {
            "name": "PromiseUndo",
            "desc": "Undoes from the stack. If a current action is going on, it will finish running.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 174,
                "path": "src/undostack/src/Shared/UndoStack.lua"
            }
        },
        {
            "name": "PromiseRedo",
            "desc": "Redoes the from the stack. If a current action is going on, it will be queued.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 202,
                "path": "src/undostack/src/Shared/UndoStack.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "UndoStack",
    "desc": "",
    "source": {
        "line": 4,
        "path": "src/undostack/src/Shared/UndoStack.lua"
    }
}