There seems to be an issue with some lua from RTP's epithets when mixed with Anno Domini. The highlighted line (in red) gives this runtime error in the lua log: bad argument #2 to '?' (Key must be of type 'number' or 'string'.)
I'm clueless as to what the issue is and would be grateful for any assistance
.
I'm clueless as to what the issue is and would be grateful for any assistance

Code:
-- JFD_HasAnyEpithet
function JFD_HasAnyEpithet(playerID)
local player = Players[playerID]
for row in GameInfo.JFD_Epithets() do
if player:HasPolicy(GameInfoTypes[row.PolicyType]) then
return true
end
end
return false
end
-- JFD_HasEpithet
function JFD_HasEpithet(playerID, epithetID)
local player = Players[playerID]
local epithet = GameInfo.JFD_Epithets[epithetID]
local policyID = GameInfoTypes[epithet.PolicyType]
return player:HasPolicy(policyID)
end
-- JFD_SetHasEpithet
function JFD_SetHasEpithet(playerID, epithetID, setHasEpithet, sendNotification)
local player = Players[playerID]
[COLOR="Red"]local epithet = GameInfo.JFD_Epithets[epithetID][/COLOR]
local policyID = GameInfoTypes[epithet.PolicyType]
if setHasEpithet then
player:GrantPolicy(policyID, true)
local leaderName = JFD_GetDefaultLeaderName(playerID)
--if Sovereignty
--JFD_GetLeaderTitleShort(playerID)
local epithetShortDesc, epithetDesc = JFD_GetEpithetDescription(playerID, epithetID)
if sendNotification then
if player:IsHuman() then
JFD_SendNotification(playerID, "NOTIFICATION_GENERIC", Locale.ConvertTextKey("TXT_KEY_NOTIFICATION_JFD_EPITHET", leaderName, epithetShortDesc), Locale.ConvertTextKey("TXT_KEY_NOTIFICATION_JFD_EPITHET_SHORT"))
else
JFD_SendWorldEvent(playerID, Locale.ConvertTextKey("TXT_KEY_NOTIFICATION_JFD_EPITHET_OTHER", leaderName, epithetShortDesc), Locale.ConvertTextKey("TXT_KEY_NOTIFICATION_JFD_EPITHET_SHORT"))
end
end
for row in GameInfo.JFD_Epithets("ID <> '" .. epithetID .. "'") do
JFD_SetHasEpithet(playerID, row.ID, false)
end
else
player:RevokePolicy(policyID)
end
end