Added m_len and made ANSIString ignore MXP.
This commit is contained in:
parent
b9e560660e
commit
571b1d5fad
3 changed files with 58 additions and 16 deletions
|
|
@ -1245,3 +1245,13 @@ def calledby(callerdepth=1):
|
|||
return "[called by '%s': %s:%s %s]" % (frame[3], path, frame[2], frame[4])
|
||||
|
||||
|
||||
def m_len(target):
|
||||
"""
|
||||
Provides length checking for strings with MXP patterns, and falls
|
||||
back to normal len for other objects.
|
||||
"""
|
||||
# Would create circular import if in module root.
|
||||
from evennia.utils.ansi import ANSI_PARSER
|
||||
if inherits_from(target, basestring):
|
||||
return len(ANSI_PARSER.strip_mxp(target))
|
||||
return len(target)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue