Originally Posted by Clamsoda
Lua Code:
-- originalName is defined is this fashion as an example; in practice -- you will want to pass whatever variable contains the NAME-REALM key -- into strsplit(). local originalName = "Clamsoda-BleedingHollow" local unitName, unitRealm = strsplit("-", originalName) print(unitRealm and unitName.."(*)" or unitName)
What is happening here is that strsplit will pass everything before and after the defined delimiter to as many variables as we allow it to. NAME-REALM keys are always delimited by a "-", and I am almost positive that no REALM keys contain a "-", thus we can safely split the name from the realm in this way. If unitRealm becomes defined, we print unitName with "(*)" concatenated; else we print just the name.
This should be quite adaptable, let me know if you need any further assistance.
|
Will this just work on Party member names or all name game wide?
Coke