MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | SYNOPSIS |
Zesstra | 5481d49 | 2021-04-08 20:07:06 +0200 | [diff] [blame] | 2 | <object|lwobject>* caller_stack() |
| 3 | <object|lwobject>* caller_stack(int add_interactive) |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 4 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 5 | DESCRIPTION |
| 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 9 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 10 | 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 13 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 14 | 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 18 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 19 | EXAMPLES |
| 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 23 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 24 | 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 User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 26 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 27 | HISTORY |
| 28 | Introduced in LDMud 3.2.6, suggested by Tubmud. |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 29 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame^] | 30 | SEE ALSO |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 31 | caller_stack_depth(E), previous_object(E), this_interactive(E), |
| 32 | call_other(E) |