Attached is a scene though just about any scene will do to highlight that VP_GetContact() appears broken due to a case conversion issue on the submitted guid. Load the scene, run the following.
Code: Select all
local u = SE_GetUnit({name='Stinger #1', guid='4FH7PU-0HM0LV5RLV4JO'});
print(u.ascontact)
for k,v in pairs(u.ascontact) do
local c = VP_GetContact({GUID=v.guid}); -- error here, submitted contact guid will be 4FH7PU-0HM0LV5RMAMDN
print(c);
end
--If you want to check the contacts for the detecting side you can see this is the valid contact guid.
local s = VP_GetSide({NAME="EC"})
for k,v in pairs(s.contacts) do
if v.guid == '4FH7PU-0HM0LV5RMAMDN' then
print(v);
end
end
if (Operators.CompareString(the contact.guid that is caps, submittedGuid.ToLower(), false) == 0)
The change needed is either remove the .ToLower for CMO, OR change the false param for text compare to true and optionally don't bother with the the case conversion. When set to true in testing the function works as expected and successfully finds the match and returns me the contact. The textcompare param change option strikes me as more likely to work for any version of the code base.
Now there is of course a second attempt to do the match, and that one uses string.equals() with the ordinalIgnoreCase option as it should. However it never gets that far because at least in this case, the for-each is operating on the side's Lazy<ConcurrentDictionary<string,Contact> object which is empty for all sides, and seems to always be during my testing but maybe it's not always the case.
As for when it broke, probably since CMO release is my guess, last time I ran into it some months back I was able to avoid using the function for what I needed and forgot to report it or ask about it after being distracted with another issue.
