Skip to content

API Reference

Tim West edited this page Mar 31, 2023 · 1 revision

Library Methods

:New(frameTitle)

Creates an interface.

Arguments

  • frameTitle : string - Text to be displayed on the title bar of the display frame for the interface.

Return Values

  • interface : table

Example

	local LibTextDump = LibStub("LibTextDump-1.0")
	local interface = LibTextDump:New("This is MY Title")

Interface Methods

:AddLine(text[, dateFormat])

Adds a line of text to the interface's buffer.

Arguments

  • text : string - Text to be added to a new line.
  • dateFormat : string - Optional format parameter passed to the Lua date function. If present, prefixes text with [dateFormat].

Example

  interface:AddLine("Hello, there!")
  interface:AddLine("What is the current time?", "%X")
  interface:AddLine("What is today's date?", "%Y-%m-%d")

Output:

Hello, there!

[02:04:55] What is the current time?

[2016-08-09] What is today's date?

:Clear()

Clears the contents of the interface's buffer.

:Display([separator])

Shows the display frame for the interface, populated with the contents of the interface's buffer.

Arguments

  • separator : string or nil - Optional separator for concatenating the buffer's lines together. Defaults to a newline.

:InsertLine(position, text[, dateFormat])

Inserts a line of text at the specified position in the interface's buffer.

Arguments

  • position : number - Index of insertion.
  • text : string - Text to be added to a new line.
  • dateFormat : string - Optional format parameter passed to the Lua date function. If present, prefixes text with [dateFormat].

Example

	interface:InsertLine(3, "Hello, there!")
	interface:InsertLine(3, "What is the current time?", "%X")
	interface:InsertLine(3, "What is today's date?", "%Y-%m-%d")

Output:

[2016-08-09] What is today's date?

[02:04:55] What is the current time?

Hello, there!

:Lines()

Returns the number of lines in the interface's buffer.

:String([separator])

Returns the string representation of the interface's buffer.

Arguments

  • separator : string or nil - Optional separator for concatenating the buffer's lines together. Defaults to a newline.

Return Values

  • interface buffer : string