Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (30 sloc) 1.46 KB
SYNOPSIS
int exec(object new, object old)
DESCRIPTION
exec() switches the connection from the interactive object old
to the object new. If the new object is also interactive, it's
connection will be transferred to the old object, thus
exchaning the two connections between the object. If the new
object is not interactive, the old will not be interactive
anymore after the exec call succeeded.
The result is 1 on success, and 0 on failure.
exec() is used to load different "user objects" or to reconnect
link dead users.
To provide security mechanisms, the interpreter calls
master->valid_exec(current_program, new, old), which must
return anything other than 0 to allow this exec() invocation.
After the exec(), if arg 2 was this_player(), this_player()
becomes arg 1, else vice versa. Ditto for this_interactive().
Take care when writing a simul-efun around exec(): the
'current_program' passed to the valid_exec() function will be
that of the simul-efun object. To get around this, use
bind_lambda() to bind #'exec to the real object and funcall()
the resulting closure.
EXAMPLES
ob = clone_object("std/player");
exec(ob, this_object());
destruct(this_object());
HISTORY
LDMud 3.2.9 added the switchover of this_interactive().
SEE ALSO
connect(M), disconnect(M), logon(A), interactive(E)