From 4f895be97aa4ea9a5b9a9cdabda50a5680d26960 Mon Sep 17 00:00:00 2001 From: shagu Date: Sun, 10 Oct 2021 12:21:58 +0200 Subject: [PATCH] custom: add custom user defined code module --- ShaguTweaks-tbc.toc | 3 +++ ShaguTweaks.toc | 3 +++ mods/custom.lua | 28 ++++++++++++++++------------ 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/ShaguTweaks-tbc.toc b/ShaguTweaks-tbc.toc index 744b432..07589d0 100644 --- a/ShaguTweaks-tbc.toc +++ b/ShaguTweaks-tbc.toc @@ -28,6 +28,9 @@ libs\libunitscan.lua libs\libhealth.lua libs\libnameplate.lua +# custom +mods\custom.lua + # modules mods\dark-ui-elements.lua mods\equip-compare.lua diff --git a/ShaguTweaks.toc b/ShaguTweaks.toc index 71b6392..90d0858 100644 --- a/ShaguTweaks.toc +++ b/ShaguTweaks.toc @@ -28,6 +28,9 @@ libs\libunitscan.lua libs\libhealth.lua libs\libnameplate.lua +# custom +mods\custom.lua + # modules mods\dark-ui-elements.lua mods\equip-compare.lua diff --git a/mods/custom.lua b/mods/custom.lua index 91b65e1..ddd38e7 100644 --- a/mods/custom.lua +++ b/mods/custom.lua @@ -1,20 +1,24 @@ --- This is a sample module skeleton. --- It does not serve any purpose, other than showing how to write a module. --- Don't forget to add your module to the *.toc file once you're done. +-- This module can be used to add your own custom code. +-- Make sure to read the comments carefully. -local _G = _G or getfenv(0) -local GetExpansion = ShaguTweaks.GetExpansion - --- Remove this line, if you want the code for both expansions -if GetExpansion() == "tbc" then return end +-- Remove the following line to activate the module: +if true then return end -- This table holds the meta-data of the module: local module = ShaguTweaks:register({ - title = "Custom Options", - description = "A template module, showcasing custom changes", - enabled = nil, + title = "Custom Settings", + description = "Custom code: Have a look at mods/custom.lua", + expansions = { ["vanilla"] = true, ["tbc"] = true }, + enabled = nil, }) +-- Global code: +-- This is where you can put your most basic variable assignments. +-- Code in this scope will *always* run, no matter if the module is enabled or not. +local _G = _G or getfenv(0) + module.enable = function(self) - -- this code is running, if the mod gets enabled in the settings + -- Module code: + -- This is where you should put your changes. + -- Code in this scope will *only* if the module is enabled. end