mirror of
https://github.com/evennia/evennia.git
synced 2026-03-31 21:17:17 +02:00
Added the ability for the Command.func() method to return a value. This allows to potentially do e.g. value = caller.execute_cmd('cmdname'). Not used at all by default commands nor the engine itself, but potentially useful for admins wanting to implement some sort of 'nested' command structure, maybe using a custom input language.
This commit is contained in:
parent
7195e1e773
commit
e7b46c89b4
2 changed files with 10 additions and 3 deletions
|
|
@ -234,11 +234,13 @@ def cmdhandler(caller, raw_string, unloggedin=False, testing=False):
|
|||
|
||||
# Parse and execute
|
||||
cmd.parse()
|
||||
cmd.func()
|
||||
# (return value is normally None)
|
||||
ret = cmd.func()
|
||||
|
||||
# post-command hook
|
||||
cmd.at_post_cmd()
|
||||
# Done!
|
||||
# Done! By default, Evennia does not use this return at all
|
||||
return ret
|
||||
|
||||
except ExecSystemCommand, exc:
|
||||
# Not a normal command: run a system command, if available,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue