Addons API
API that mspaint exposes to addons
How to develop addons
To create an addon, you simply create a .lua
/.luau
/.txt
file in the mspaint/addons
folder. Then add addon info at the top of the file and you should be good to go.
The mspaint.AddonInfo
table is required to be set and should be the first thing that executes in the file. Or else mspaint.Groupbox
will not be available (will return nil
).
If mspaint detects that you are not in the correct game, it will stop loading the addon from where you set the mspaint.AddonInfo
table.
Example
mspaint
This is a table that contains all essential information/functions for the addon to work.
AddonInfo
This is the table that contains the information about the addon. It is required to be set and should be the first thing that executes in the file.
Prop | Type | Default |
---|---|---|
Name | string | - |
Title | string | - |
Description | string | - |
Game | string | number | table | - |
Example
DiscordUserData
This is a table that contains the user's discord data based on their luarmor key.
Prop | Type | Default |
---|---|---|
id | string | - |
global_name | string | - |
username | string | - |
Example
CurrentLanguage
This is a string that contains the user's current language. It follows the IEFT language tag format (e.g. en
, zh-cn
)
Example
ExecutorSupport
Contains a table with the results of the UNC test done by mspaint at the start of loading the script.
Example
Groupbox
This is the groupbox that contains all the elements that were created by the addon. You can use this to add UI elements to the groupbox.
To learn more about the available elements and their arguments, check out the Obsidian documentation (Groupbox is essentially :AddLeftGroupbox()
/:AddRightGroupbox()
from Obsidian).
Example
Options
This is a table that contains all the Options that were created by the addons. (to learn more about the use case of "Options" check out the Obsidian documentation)
Toggles
This is a table that contains all the Toggles that were created by the addons. (to learn more about the use case of "Toggles" check out the Obsidian documentation)
You no longer need to use AddonName_Toggle/Option
to access the options/toggles in your addons.
You can just use the Options and Toggles tables directly.
Example:
However keep in mind that you can only access the Options/Toggles that were created by the addon with the global Options
and Toggles
tables.
If you want to access every single toggle or option, you can use mspaint.Library.Options
and mspaint.Library.Toggles
respectively.
Library
This is the table returned by Linoria/Obsidian. Can be used to create notifications. For more information, check out the Obsidian documentation.
Example