Home

LuaUndoRedoStack

The undo queue for a player. The term item_index refers to the index of an undo item in the queue, while action_index refers to the index of one of the individual actions that make up an undo item.

Items are added to the undo queue through player actions and Lua methods that emulate player actions like LuaEntity::order_upgrade.

Attributes

player_index

The index of the player to whom this stack belongs to.

valid

Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be false. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.

object_name

The class name of this object. Available even when valid is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.

Methods

get_undo_item

LuaUndoRedoStack.get_undo_item(index: uint32) -> Array<UndoRedoAction>

Call As

undoRedoStack.get_undo_item(index)

Call Convention

Gets an undo item from the undo stack.

Parameters

Returns

get_undo_item_count

LuaUndoRedoStack.get_undo_item_count() -> uint32

Call As

undoRedoStack.get_undo_item_count()

Call Convention

The number undo items in the undo stack.

Returns

remove_undo_item

LuaUndoRedoStack.remove_undo_item(index: uint32)

Call As

undoRedoStack.remove_undo_item(index)

Call Convention

Removes an undo item from the undo stack.

Parameters

remove_undo_action

LuaUndoRedoStack.remove_undo_action(item_index: uint32, action_index: uint32)

Call As

undoRedoStack.remove_undo_action(item_index, action_index)

Call Convention

Removes an undo action from the specified undo item on the undo stack.

Parameters

get_redo_item

LuaUndoRedoStack.get_redo_item(index: uint32) -> Array<UndoRedoAction>

Call As

undoRedoStack.get_redo_item(index)

Call Convention

Gets an undo item from the redo stack.

Parameters

Returns

get_redo_item_count

LuaUndoRedoStack.get_redo_item_count() -> uint32

Call As

undoRedoStack.get_redo_item_count()

Call Convention

The number of undo items in the redo stack.

Returns

remove_redo_item

LuaUndoRedoStack.remove_redo_item(index: uint32)

Call As

undoRedoStack.remove_redo_item(index)

Call Convention

Removes an undo item from the redo stack.

Parameters

remove_redo_action

LuaUndoRedoStack.remove_redo_action(item_index: uint32, action_index: uint32)

Call As

undoRedoStack.remove_redo_action(item_index, action_index)

Call Convention

Removes an undo action from the specified undo item on the redo stack.

Parameters

get_undo_tags

LuaUndoRedoStack.get_undo_tags(item_index: uint32, action_index: uint32) -> Tags

Call As

undoRedoStack.get_undo_tags(item_index, action_index)

Call Convention

Gets all tags for the given undo action.

Parameters

Returns

get_undo_tag

LuaUndoRedoStack.get_undo_tag(item_index: uint32, action_index: uint32, tag_name: string) -> AnyBasic

Call As

undoRedoStack.get_undo_tag(item_index, action_index, tag_name)

Call Convention

Gets the tag with the given name from a specific undo item action, or nil if it doesn't exist.

Parameters

Returns

set_undo_tag

LuaUndoRedoStack.set_undo_tag(item_index: uint32, action_index: uint32, tag_name: string, tag: AnyBasic)

Call As

undoRedoStack.set_undo_tag(item_index, action_index, tag_name, tag)

Call Convention

Sets a new tag with the given name and value on the specified undo item action.

Parameters

remove_undo_tag

LuaUndoRedoStack.remove_undo_tag(item_index: uint32, action_index: uint32, tag: string) -> boolean

Call As

undoRedoStack.remove_undo_tag(item_index, action_index, tag)

Call Convention

Removes a tag with the given name from the specified undo item.

Parameters

Returns

get_redo_tags

LuaUndoRedoStack.get_redo_tags(item_index: uint32, action_index: uint32) -> Tags

Call As

undoRedoStack.get_redo_tags(item_index, action_index)

Call Convention

Gets all tags for the given redo action.

Parameters

Returns

get_redo_tag

LuaUndoRedoStack.get_redo_tag(item_index: uint32, action_index: uint32, tag_name: string) -> AnyBasic

Call As

undoRedoStack.get_redo_tag(item_index, action_index, tag_name)

Call Convention

Gets the tag with the given name from a specific redo item action, or nil if it doesn't exist.

Parameters

Returns

set_redo_tag

LuaUndoRedoStack.set_redo_tag(item_index: uint32, action_index: uint32, tag_name: string, tag: AnyBasic)

Call As

undoRedoStack.set_redo_tag(item_index, action_index, tag_name, tag)

Call Convention

Sets a new tag with the given name and value on the specified redo item action.

Parameters

remove_redo_tag

LuaUndoRedoStack.remove_redo_tag(item_index: uint32, action_index: uint32, tag: string) -> boolean

Call As

undoRedoStack.remove_redo_tag(item_index, action_index, tag)

Call Convention

Removes a tag with the given name from the specified redo item.

Parameters

Returns