Skip to content

How to use

bullsei edited this page Oct 10, 2022 · 5 revisions

Creates a simple Blizzlike frame for your changelog.

Usage

local LibChangelog = LibStub("LibChangelog")

Methods

LibChangelog:Register(addonName, changelogTable, savedVariablesTable, lastReadVersionKey, onlyShowWhenNewVersionKey, texts)

Description: Registers your changelog table and creates

Arguments:

  • addonName: string, the name of your addon, used to store the data internally and to show the changelog frame via :Display()
  • changelogTable: table, Your changelog table (changelogTable[1] must be the entry/sub table for the newest version)
  • savedVariablesTable: table, a reference to your saved variables, this will be used to save the last read version and whether or not the user only wants to see the frame if there is a new version
  • lastReadVersionKey: string,will be accessed like savedVariablesTable[lastReadVersionKey] The last version the user has read, the addon will gray out entrys for older versions
  • onlyShowWhenNewVersionKey: string, will be accessed like savedVariablesTable[onlyShowWhenNewVersionKey] when true the addon will only show the changelog frame when there is a unread entry in the changelogTable
  • texts (optional): table of the following format {title = "title of the frame", onlyShowWhenNewVersion = "Text for the check button to only show the frame after an update"}

LibChangelog:ShowChangelog(addonName)

Arguments:

addonName: string, the name of your addon, same as you used in :Register()

Working Example

local addonName, Data = ...
local LibChangelog = LibStub("LibChangelog")
local savedVariables = {} --Just for demonstration purpose, you would use your own saved variables table here


local changelog = {
    {
        Version = "3",
        General = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
        Sections = {
            {
                Header = "New Features",
                Entries = {
                    "Added a new window that shows changes made in new releases"
                }
            }
        }
    },
    {
        Version = "2",
        Sections = {
            {
                Header = "Bugfixes",
                Entries = {
                    "Fixed bug 1",
                    "Fixed bug 2"
                }
            }
        }
    },
    {
        Version = "1",
        Sections = {
            {
                Header = "New Features",
                Entries = {
                    "New feature 1",
                    "New feature 2",
                }
            }
        }
    }
}
LibChangelog:Register(addonName, changelog, savedVariables, "lastReadVersion", "onlyShowWhenNewVersion")
LibChangelog:ShowChangelog(addonName)