blob: c86d3e07d4abfa1e290b37c231e9828c5e6eeb62 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
2 int exec(object new, object old)
3
4DESCRIPTION
5 exec() switches the connection from the interactive object old
6 to the object new. If the new object is also interactive, it's
7 connection will be transferred to the old object, thus
8 exchaning the two connections between the object. If the new
9 object is not interactive, the old will not be interactive
10 anymore after the exec call succeeded.
11
12 The result is 1 on success, and 0 on failure.
13
14 exec() is used to load different "user objects" or to reconnect
15 link dead users.
16
17 To provide security mechanisms, the interpreter calls
18 master->valid_exec(current_program, new, old), which must
19 return anything other than 0 to allow this exec() invocation.
20
21 After the exec(), if arg 2 was this_player(), this_player()
22 becomes arg 1, else vice versa. Ditto for this_interactive().
23
24 Take care when writing a simul-efun around exec(): the
25 'current_program' passed to the valid_exec() function will be
26 that of the simul-efun object. To get around this, use
27 bind_lambda() to bind #'exec to the real object and funcall()
28 the resulting closure.
29
30EXAMPLE
31 ob = clone_object("std/player");
32 exec(ob, this_object());
33 destruct(this_object());
34
35HISTORY
36 LDMud 3.2.9 added the switchover of this_interactive().
37
38SEE ALSO
39 connect(M), disconnect(M), logon(A), interactive(E)