pub struct LuaUndoRedoStack;Expand description
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.
Implementations§
Source§impl LuaUndoRedoStack
impl LuaUndoRedoStack
Sourcepub fn object_name(&self) -> &str
pub fn object_name(&self) -> &str
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.
Sourcepub fn player_index(&self) -> u32
pub fn player_index(&self) -> u32
The index of the player to whom this stack belongs to.
Sourcepub fn valid(&self) -> bool
pub fn valid(&self) -> bool
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.
Sourcepub fn get_redo_item(&self, index: u32) -> Vec<UndoRedoAction>
pub fn get_redo_item(&self, index: u32) -> Vec<UndoRedoAction>
Gets an undo item from the redo stack.
Sourcepub fn get_redo_item_count(&self) -> u32
pub fn get_redo_item_count(&self) -> u32
The number of undo items in the redo stack.
Sourcepub fn get_redo_tag(
&self,
action_index: u32,
item_index: u32,
tag_name: &str,
) -> LuaAny
pub fn get_redo_tag( &self, action_index: u32, item_index: u32, tag_name: &str, ) -> LuaAny
Gets the tag with the given name from a specific redo item action, or nil if it doesn’t exist.
Gets all tags for the given redo action.
Sourcepub fn get_undo_item(&self, index: u32) -> Vec<UndoRedoAction>
pub fn get_undo_item(&self, index: u32) -> Vec<UndoRedoAction>
Gets an undo item from the undo stack.
Sourcepub fn get_undo_item_count(&self) -> u32
pub fn get_undo_item_count(&self) -> u32
The number undo items in the undo stack.
Sourcepub fn get_undo_tag(
&self,
action_index: u32,
item_index: u32,
tag_name: &str,
) -> LuaAny
pub fn get_undo_tag( &self, action_index: u32, item_index: u32, tag_name: &str, ) -> LuaAny
Gets the tag with the given name from a specific undo item action, or nil if it doesn’t exist.
Gets all tags for the given undo action.
Sourcepub fn remove_redo_action(&self, action_index: u32, item_index: u32)
pub fn remove_redo_action(&self, action_index: u32, item_index: u32)
Removes an undo action from the specified undo item on the redo stack.
Sourcepub fn remove_redo_item(&self, index: u32)
pub fn remove_redo_item(&self, index: u32)
Removes an undo item from the redo stack.
Sourcepub fn remove_redo_tag(
&self,
action_index: u32,
item_index: u32,
tag: &str,
) -> bool
pub fn remove_redo_tag( &self, action_index: u32, item_index: u32, tag: &str, ) -> bool
Removes a tag with the given name from the specified redo item.
Sourcepub fn remove_undo_action(&self, action_index: u32, item_index: u32)
pub fn remove_undo_action(&self, action_index: u32, item_index: u32)
Removes an undo action from the specified undo item on the undo stack.
Sourcepub fn remove_undo_item(&self, index: u32)
pub fn remove_undo_item(&self, index: u32)
Removes an undo item from the undo stack.
Sourcepub fn remove_undo_tag(
&self,
action_index: u32,
item_index: u32,
tag: &str,
) -> bool
pub fn remove_undo_tag( &self, action_index: u32, item_index: u32, tag: &str, ) -> bool
Removes a tag with the given name from the specified undo item.
Trait Implementations§
Source§impl Clone for LuaUndoRedoStack
impl Clone for LuaUndoRedoStack
Source§fn clone(&self) -> LuaUndoRedoStack
fn clone(&self) -> LuaUndoRedoStack
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more