CloseUndo(handle)
Description
Section titled âDescriptionâThe CloseUndo Lua function closes an open undo list. The function returns a boolean indicating if the function succeeds.
Undo lists need to be created to be closed. See more about this in the CreateUndo function.
Arguments
Section titled âArgumentsâ- Handle:
The handle of a created undo list.
-
Boolean:
- True: The undo list was closed.
- False: The undo list is still in use and cannot be closed.
Example
Section titled âExampleâThis example creates an undo list, performs a series of commands that are added to the undo list, and closes the undo list. Now the series of commands can be oopsed with one oops command.
| Copy CodeLua |
| ``` |
| return function() |
--Create the undo objectlocal MyNewUndo = CreateUndo("MySelection")--Create command actions connected to the undo objectCmd("ClearAll", MyNewUndo)Cmd("Fixture 1", MyNewUndo)Cmd("Fixture 2", MyNewUndo)Cmd("Fixture 5", MyNewUndo)Cmd("Fixture 7", MyNewUndo)--Close the undo group and store it's return in a variablelocal closeSuccess = CloseUndo(MyNewUndo)--Print the feedback from the closing action - 1 = Success / 0 = Failure.if closeSuccess == false then ErrPrintf("The CloseUndo was not successful")elseif closeSuccess == true then Printf("The CloseUndo was successful")else Printf("The CloseUndo did not return a meaningful result")endend