Skip to main content

UndoStack

Functions​

ClearRedoStack​

UndoStack.ClearRedoStack(self: UndoStack) → boolean

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

IsActionExecuting​

UndoStack.IsActionExecuting(self: UndoStack) → boolean

Returns true if an action is executing

ObserveHasUndoEntries​

UndoStack.ObserveHasUndoEntries(self: UndoStack) → Observable<boolean>

Observes whether the stack has undo entries

ObserveHasRedoEntries​

UndoStack.ObserveHasRedoEntries(self: UndoStack) → Observable<boolean>

Observes whether the stack has redo entries

HasUndoEntries​

UndoStack.HasUndoEntries(self: UndoStack) → boolean

Returns true if there are undo entries on the stack

HasRedoEntries​

UndoStack.HasRedoEntries(self: UndoStack) → boolean

Returns true if there are redo entries on the stack

Push​

UndoStack.Push(
self: UndoStack,
undoStackEntry: UndoStackEntry
) → 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(
self: UndoStack,
undoStackEntry: Theundostackentrytoremove
) → ()

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

PromiseUndo​

UndoStack.PromiseUndo(self: UndoStack) → Promise

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

PromiseRedo​

UndoStack.PromiseRedo(self: UndoStack) → 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": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "UndoStack"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 58,
                "path": "src/undostack/src/Shared/UndoStack.lua"
            }
        },
        {
            "name": "IsActionExecuting",
            "desc": "Returns true if an action is executing",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "UndoStack"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 67,
                "path": "src/undostack/src/Shared/UndoStack.lua"
            }
        },
        {
            "name": "ObserveHasUndoEntries",
            "desc": "Observes whether the stack has undo entries",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "UndoStack"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<boolean>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 75,
                "path": "src/undostack/src/Shared/UndoStack.lua"
            }
        },
        {
            "name": "ObserveHasRedoEntries",
            "desc": "Observes whether the stack has redo entries",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "UndoStack"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Observable<boolean>"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 83,
                "path": "src/undostack/src/Shared/UndoStack.lua"
            }
        },
        {
            "name": "HasUndoEntries",
            "desc": "Returns true if there are undo entries on the stack",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "UndoStack"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 91,
                "path": "src/undostack/src/Shared/UndoStack.lua"
            }
        },
        {
            "name": "HasRedoEntries",
            "desc": "Returns true if there are redo entries on the stack",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "UndoStack"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 99,
                "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": "self",
                    "desc": "",
                    "lua_type": "UndoStack"
                },
                {
                    "name": "undoStackEntry",
                    "desc": "",
                    "lua_type": "UndoStackEntry"
                }
            ],
            "returns": [
                {
                    "desc": "Callback that removes the action",
                    "lua_type": "function"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 121,
                "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": "self",
                    "desc": "",
                    "lua_type": "UndoStack"
                },
                {
                    "name": "undoStackEntry",
                    "desc": "",
                    "lua_type": "The undo stack entry to remove"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 162,
                "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": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "UndoStack"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 191,
                "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": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "UndoStack"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "Promise"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 218,
                "path": "src/undostack/src/Shared/UndoStack.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "UndoStack",
    "desc": "",
    "source": {
        "line": 5,
        "path": "src/undostack/src/Shared/UndoStack.lua"
    }
}