The undo library allows you to add custom entities to the undo list, allowing users to "undo" their creation with their undo (default: z) key.
undo.AddFunction( function func, vararg arguments )
Adds a function to call when the current undo block is undone. Note that if an undo has a function, the player will always be notified when this undo is performed, even if the entity it is meant to undo no longer exists.
number undo.Do_Undo( table tab )
Processes an undo block (in table form). This is used internally by the undo manager when a player presses Z. You should use gm_undo or gm_undonum *num* console commands instead of calling this function directly.
Serverside, returns a table containing all undo blocks of all players. Clientside, returns a table of the local player's undo blocks. Serverside, this table's keys use Player:UniqueID to store a player's undo blocks.
This is used internally - although you're able to use it you probably shouldn't. Makes the UI dirty - it will re-create the controls the next time it is viewed.
boolean undo.ReplaceEntity( Entity from, Entity to )
Replaces any instance of the "from" reference with the "to" reference, in any existing undo block. Returns true if something was replaced
This is used internally - although you're able to use it you probably shouldn't. Adds a hook (CPanelPaint) to the control panel paint function so we can determine when it is being drawn.