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:
Griatch 2011-10-27 10:18:18 +02:00
parent 7195e1e773
commit e7b46c89b4
2 changed files with 10 additions and 3 deletions

View file

@ -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,