/doc/efun/previous_object


SYNOPSIS

object previous_object()
object previous_object(int i)

DESCRIPTION

Returns an object pointer to the object that did a call_other() to the current object, if any. There are two exceptions for previous_object(). When the object calls a own function with a call_other() the previous_object() will be unchanged and when a destructed object calls a function of the current object previous_object() will return 0.

If the optional arg is given, the call_other()s are followed back i times (i.e. previous_object(2) returns the caller of the caller). 0 <= i <= caller_stack_depth()-1

EXAMPLE

	int security() {
	   object prev;
	   if(!(prev=previous_object()));
	   else if(getuid(prev)!=getuid(this_object()));
	   else if(geteuid(prev)!=geteuid(this_object()));
	   else return 1;
	   return 0;
	}
	void high_sensible_func() {
	   if(!security())
	      return;
	   ...
	}
This example shows how we can check if the last call to a function of the current object is secure or if we should abort execution.

SEE ALSO

call_other
this_object
this_player
caller_stack_depth
extern_call

| Home | Applied | Concepts | Efuns | Help | Intro | Lib | LPC | Prop | Obj | Sefuns | Std | W |

Nightfall@quest.tat.physik.uni-tuebingen.de
Automatically generated on Don, 11. Apr 1996