mirror of
https://github.com/evennia/evennia.git
synced 2026-04-06 07:57:16 +02:00
Move regex out of protofunc to prevent recompilation on each call.
This commit is contained in:
parent
419045fef4
commit
70eeb6f6be
1 changed files with 2 additions and 1 deletions
|
|
@ -44,6 +44,8 @@ from evennia.utils.utils import justify as base_justify, is_iter, to_str
|
|||
|
||||
_PROTLIB = None
|
||||
|
||||
_RE_DBREF = re.compile(r"\#[0-9]+")
|
||||
|
||||
|
||||
# default protfuncs
|
||||
|
||||
|
|
@ -333,7 +335,6 @@ def dbref(*args, **kwargs):
|
|||
Usage $dbref(<#dbref>)
|
||||
Returns one Object searched globally by #dbref. Error if #dbref is invalid.
|
||||
"""
|
||||
_RE_DBREF = re.compile(r"\#[0-9]+")
|
||||
if not args or len(args) < 1 or _RE_DBREF.match(args[0]) is None:
|
||||
raise ValueError('$dbref requires a valid #dbref argument.')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue