If this is your own layout, why are you creating a separate function to put a backdrop on the raid target icon? Just add the backdrop in the same place you create the icon in the first place.
Also, you can't parent a frame to a texture, and the second argument to CreateFrame must be either a string or nil (and for something like this should be nil), one of which is why you're getting that error.
Code:
local iconFrame = CreateFrame("Frame", nil, f)
iconFrame:SetPoint("RIGHT", 5, 0)
iconFrame:SetSize(24, 24)
iconFrame:SetBackdrop({
bgFile = "Interface\\BUTTONS\\WHITE8x8", tile = true, tileSize = 8,
edgeFile = "Interface\\BUTTONS\\WHITE8x8", edgeSize = 1,
insets = { left = 1, right = 1, top = 1, bottom = 1 }
})
iconFrame:SetBackdropColor(0, 0, 0, 0.5)
iconFrame:SetBackdropBorderColor(0, 0, 0, 1)
local icon = iconFrame:CreateTexture(nil, "ARTWORK")
icon:SetAllPoints(true)
icon:SetTexture("Interface\\TargetingFrame\\UI-RaidTargetingIcons")
iconFrame.icon = icon
iconFrame.Override = function(self, event)
local index = GetRaidTargetIndex(self.unit)
if index then
SetRaidTargetIconTexture(self.RaidIcon.icon, index)
self.RaidIcon:Show()
else
self.RaidIcon:Hide()
end
end
f.RaidIcon = iconFrame