Thanks for your anwer.
I'm currently using
public static int? GetGroupNumber(this WoWUnit instance)
{
// Create lua command
string luaCommand = $@"for i = 1, GetNumRaidMembers() do
name, rank, groupNumber = GetRaidRosterInfo(i);
if(name == '{instance.Name}') then
return groupNumber;
end
end
";
// Get index number of the unit
int result = Framelock.Lock(() =>
{
// Return
return Lua.LuaDoString<int>(command: luaCommand);
});
// Failed?
if (result == 0)
{
// Return
return null;
}
// Return
return result;
}
But I will compare both methods and check what performs better.