Skip to content

Commit

Permalink
Framework Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Oct 11, 2023
1 parent 0cca378 commit ac21f31
Show file tree
Hide file tree
Showing 28 changed files with 4,106 additions and 2,991 deletions.
53 changes: 53 additions & 0 deletions Libs/DF/addon.examples.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

--[=[
for this example, let's consider the name of your addon is "Slice And Dance"
addon folder name on World of Warcraft/_retail_/Interface/AddOns/SliceAndDance/
toc file example /World of Warcraft/_retail_/Interface/AddOns/SliceAndDance/SliceAndDance.toc:
## Interface: 100107
## Title: "Slice And Dance"
## Notes: Show a slice and dice bar for rogues
## SavedVariables: SliceAndDanceDatabase
SliceAndDance_Core.lua
--]=]

--create a new file on your addon folder called "SliceAndDance_Core.lua"
--this are the contents to add to the file

--each file of your addon receives a payload with the addon name and a private table
--this private table is shared between all files of your addon and cannot be accessed by other addons or scripts
--the addon name is the ToC name of your addon, the toc is also the folder name of your addon in the addons folder
local addonName, priviteTable = ...

--saved variables name
--this is the name of the global table where your addon will store it's saved variables
--you define this on the addon.toc file under the line "## SavedVariables: SliceAndDanceDatabase"
local savedVariablesName = "SliceAndDanceDatabase"

--default settings
--a simple table with default settings for your addon, any value modified by the user will be stored in the saved variables table
--if your addon doesn't have any settings, you can just pass an empty table
local defaultSettingsExample = {
width = 500,
height = 500,
name = "John",
}

local detailsFramework = DetailsFramework
--create the core addon object, this is a table which will all public functions of your addon
local myNewAddonObject = detailsFramework:CreateNewAddOn(addonName, savedVariablesName, defaultSettingsExample)

--by default, the table generated by the CreateNewAddOn() isn't placed in the global environment
--if this is desired for some reason, you can do it manually
_G.MyNewAddon = myNewAddonObject

--this function is called when the savedVariables of your addon is ready to be used
function myNewAddonObject.OnLoad(self, profile)
--self is: myNewAddonObject
--profile is a table with defaultSettingsExample
end

--this function is called when when the loading screen is done and the player character is ready to play
function myNewAddonObject.OnInit(self, profile) --fired from detailsFramework at PLAYER_LOGIN
--self is: myNewAddonObject
--profile is a table with defaultSettingsExample
end
2 changes: 1 addition & 1 deletion Libs/DF/addon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function detailsFramework:CreateNewAddOn(addonName, globalSavedVariablesName, sa
end


--old create addon
--old create addon using ace3
function detailsFramework:CreateAddOn(name, global_saved, global_table, options_table, broker)

local addon = LibStub("AceAddon-3.0"):NewAddon (name, "AceConsole-3.0", "AceEvent-3.0", "AceTimer-3.0", "DetailsFramework-1.0", "AceComm-3.0")
Expand Down
Loading

0 comments on commit ac21f31

Please sign in to comment.