You mean something like this:
Code:
local COMBAT
WoWEvents:Bind("PLAYER_REGEN_DISABLED", nil, function() COMBAT = 1 end)
WoWEvents:Bind("PLAYER_REGEN_ENABLED", nil, function() COMBAT = nil end)
local function test()
if COMBAT then
print("You are in combat.")
else
print("You are not in combat.")
end
end
The idea is that these 2 events that run set the COMBAT value to 1 or nil, so you can later in your addon code use that to know if you are in combat or not.
I've had some issues using IsCombatLockdown() myself, some times my code didn't work so I got fed up and started to use the method above, so set a variable to 1 or nil that my addon used to decide if in combat or not, not sure why the API doesn't always work like it should (had problems creating secure frames as it was not accurate as I thought it would be.)