Skip to main content

UndoStack

Functions

ClearRedoStack

UndoStack.ClearRedoStack(selfUndoStack) → boolean

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

IsActionExecuting

UndoStack.IsActionExecuting(selfUndoStack) → boolean

Returns true if an action is executing

ObserveHasUndoEntries

UndoStack.ObserveHasUndoEntries(selfUndoStack) → Observable<boolean>

Observes whether the stack has undo entries

ObserveHasRedoEntries

UndoStack.ObserveHasRedoEntries(selfUndoStack) → Observable<boolean>

Observes whether the stack has redo entries

HasUndoEntries

UndoStack.HasUndoEntries(selfUndoStack) → boolean

Returns true if there are undo entries on the stack

HasRedoEntries

UndoStack.HasRedoEntries(selfUndoStack) → boolean

Returns true if there are redo entries on the stack

Push

UndoStack.Push(
selfUndoStack,
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(
selfUndoStack,
undoStackEntryTheundostackentrytoremove
) → ()

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

PromiseUndo

UndoStack.PromiseUndo(selfUndoStack) → Promise

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

PromiseRedo

UndoStack.PromiseRedo(selfUndoStack) → 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": 56,
                "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": 65,
                "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": 73,
                "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": 81,
                "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": 89,
                "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": 97,
                "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": 119,
                "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": 160,
                "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": 189,
                "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": 216,
                "path": "src/undostack/src/Shared/UndoStack.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "UndoStack",
    "desc": "",
    "source": {
        "line": 5,
        "path": "src/undostack/src/Shared/UndoStack.lua"
    }
}