This class has an instance that is available in editor as: editor.history, used as example: editor.history:addAction….
Parameters: steps – how many steps to undo, default is 1 if not specified
Undo a number of steps from the history stack
Parameters: steps – how many steps to redo, default is 1 if not specified
Redo a number of steps from the history stack
Parameters: name – the name of the undo transaction (as a group of actions)
This will start a history transaction of adding multiple actions as a group
Cancels a started transaction. Used when adding actions in a transaction, and some add action failed or data is not valid
Ends a transaction successfuly and EXECUTES ALL REDO functions from all the added actions in this transaction.
addAction(name, data, undoFunc, redoFunc)¶
- name – the name of the action, in the example format “MyCreateWhatever” do not add Action at the end of the string
- data – the data used by both undo and redo functions, where you keep new and old information about the action done
- undoFunc – the undo function, which has the format: local function myCreateWhateverUndo(actionData)
- redoFunc – the redo function, which has the format: local function myCreateWhateverRedo(actionData)
This adds the action on the undo stack AND EXECUTES THE REDO function with the given data table as argument. When this function is called inside a beginTransaction/endTransaction, it will not execute the redo function until endTransaction, when all the redo functions of all the added actions inside that transaction are called at once.
Clears the history, no functions are called, everything lost.
Parameters: filename – JSON filename to save into
NOT IMPLEMENTED. Save the history to a JSON file.
Parameters: filename – JSON filename to load from
NOT IMPLEMENTED. Load the history from a JSON file.