blob: 7d6e286d276c364047f0e0d1e9decf3ba028c85a [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
Zesstra5481d492021-04-08 20:07:06 +02002 <object|lwobject>* caller_stack()
3 <object|lwobject>* caller_stack(int add_interactive)
MG Mud User88f12472016-06-24 23:31:02 +02004
Zesstra715ec202025-07-09 22:18:31 +02005DESCRIPTION
6 Returns an array of the previous_object()s who caused the
7 call_other() to this_object().
8 previous_object(i) equals caller_stack()[i].
MG Mud User88f12472016-06-24 23:31:02 +02009
Zesstra715ec202025-07-09 22:18:31 +020010 If you pass the optional argument <add_interactive> (as true value)
11 this_interactive() is appended to the array, or 0 if there is no
12 current interactive.
MG Mud User88f12472016-06-24 23:31:02 +020013
Zesstra715ec202025-07-09 22:18:31 +020014 Note: calls to 'alien lfun closures' (see symbol_function(E))
15 generate two entries on the stack if the bound object differs
16 from the closure object: the first is for the bound object,
17 the second for the closure object.
MG Mud User88f12472016-06-24 23:31:02 +020018
Zesstra715ec202025-07-09 22:18:31 +020019EXAMPLES
20 interactive object A enters a command which causes
21 a call to a function in object B, that one calls a
22 function in object C and that, in turn, in object D
MG Mud User88f12472016-06-24 23:31:02 +020023
Zesstra715ec202025-07-09 22:18:31 +020024 If D now calls caller_stack() the result would be: ({C,B}).
25 If it calls caller_stack(1) the result is: ({C,B,A}).
MG Mud User88f12472016-06-24 23:31:02 +020026
Zesstra715ec202025-07-09 22:18:31 +020027HISTORY
28 Introduced in LDMud 3.2.6, suggested by Tubmud.
Zesstrad59c3892019-11-28 20:53:39 +010029
Zesstra715ec202025-07-09 22:18:31 +020030SEE ALSO
MG Mud User88f12472016-06-24 23:31:02 +020031 caller_stack_depth(E), previous_object(E), this_interactive(E),
32 call_other(E)