Recently I've been messing around with lua and most of the stuff I can understand by looking at websites and such but something about these slashcmdlist that I just don't understand. What I am trying to do here is to make some ingame slash commands that will enable/disable parts of an addon.
This works fine with no errors ingame however it just doesn't seem to change testing1 or testing2 to true or false, so I am pretty sure I'm doing something wrong here but can't seem to figure out what it is.
Part of this might not make sense cause it's late over here but I think anyone that has to patience to read this through thank you.
Code:
local testing1 = true
local testing2 = true
SLASH_TEST1 = "/test"
SlashCmdList["TEST"] = function(msg)
if(msg) then
local command = msg:match("^(%S*)%s*(.-)$");
command = string.lower(command)
if (command == "testing1") then
if testing1 == true then
testing1 = false
print("testing1 set to false")
else
testing1 = true
print("testing1 set to true")
end
elseif (command == "testing2") then
if testing2 == true then
testing2 = false
print("testing2 set to false")
else
testing2 = true
print("testing2 set to true")
end
end
end
end