Logomspaint

Migration Guide

Migrating from the old addon system to the new one

Introduction

This guide will help you migrate your old addons to the new addon system.

Migration Guide

  1. Move addon metadata to the top of the file.
return {
    Name = "FunItems", -- Addon Name (can't contain spaces)
    Title = "Fun Items", -- Name for the groupbox
    Description = "Button Example", -- Can be empty if you don't want a description
    Game = "*", -- * means all games
    Elements = {
        {
            Type = "Button",
            Name = "Placeholder", -- Accessible by using Options[<AddonName>_<Name>], for this element you can access it by Options["FunItems_CrucfixEverything"]
            Arguments = {
                Text = 'Button',
                Tooltip = 'Button example',
 
                Func = function()
                    print("Hello from the button")
                end
            },
        },
        {
            Type = "Toggle",
            Name = "Toggle", -- Accessible by using Options[<AddonName>_<Name>], for this element you can access it by Options["ToggleExample_ToggleExample"]
            Arguments = {
                Text = 'Toggle',
                Tooltip = 'Toggle example',
                Default = false, -- Default value for the toggle
 
                Func = function(value)
                    print("Toggle is " .. (value and "On" or "Off"))
                end
            },
        }
    }
}
  1. Migrate all Elements to use mspaint.Groupbox For more information on how to migrate each type of element, check out the Obsidian documentation.
mspaint.AddonInfo = {
    Name = "FunItems", -- Addon Name (can't contain spaces)
    Title = "Fun Items", -- Name for the groupbox
    Description = "Button Example", -- Can be empty if you don't want a description
    Game = "*", -- * means all games
}
 
local Elements = {
    {
        Type = "Button",
        Name = "Placeholder", -- Accessible by using Options[<AddonName>_<Name>], for this element you can access it by Options["FunItems_CrucfixEverything"]
        Arguments = {
            Text = 'Button',
            Tooltip = 'Button example',
 
            Func = function()
                print("Hello from the button")
            end
        },
    },
    {
        Type = "Toggle",
        Name = "Toggle", -- Accessible by using Options[<AddonName>_<Name>], for this element you can access it by Options["ToggleExample_ToggleExample"]
        Arguments = {
            Text = 'Toggle',
            Tooltip = 'Toggle example',
            Default = false, -- Default value for the toggle
 
            Func = function(value)
                print("Toggle is " .. (value and "On" or "Off"))
            end
        },
    }
}
  1. Check out the API documentation to learn more about the new system.

Congratulations, you have migrated your addon to the new system!

On this page