Defer

来自MudWiki

名称

   defer() - 当前函数运行结束后执行指定函数

语法

   void defer(function f)

描述

   FluffOS 2.23 新增efun,Call function pointer *f when current function ends (even if it was due to a runtime error).

   参考教程:https://bbs.mud.ren/threads/158

示例

   void create()
   {
     ::create();

     defer( (: enable_commands :) );
   }
 
   The effect the defer() function has is it will cause the enable_commands() efun to be called after the execution of the create() function ends.  The argument passed to defer() can be any function type.