To get the value of a local variable in the frame, simply use frame[name], where 'frame' is the StackFrameDesc object for the frame, and 'name' is a string giving the name of the local variable to retrieve. If the frame is active, this retrieves the live value of the variable from the frame; otherwise it retrieves the value from a snapshot containing the last value before the routine returned to its caller.
To assign a new value to a local in the frame, assign a value to frame[name] for the desired variable name. If the frame is active, this updates the live variable in the stack frame, so when execution returns to the caller the variable will have the new value. If the frame is inactive, it updates the snapshot we made when the routine returned to its caller.
This object can't be created with 'new'. Instead, you obtain these objects via the t3GetStackTrace() function. That function retrieves information on an active stack frame in the current call stack, including the frame object.
The returned lookup table is a snapshot copy of the current values of the variables. If the underlying variable values in the frame change, the lookup table won't be affected, since it's just a separate copy made at the moment this routine is called. Similarly, changing the value of an entry in the returned lookup table won't affect the actual variable in the stack frame.
To retrieve the current live value of a variable in the actual stack frame, use frame[name], where 'frame' is the StackFrameDesc object for the frame, and 'name' is a string giving the variable name.
When the routine is about to return (so the frame is about to become inacive), the StackFrameDesc object makes a private snapshot of the variables in the frame. Subsequent access to the locals will automatically use the snapshot copy, so you can continue to access the locals as normal without worrying about whether or not the actual stack frame still exists. This allows you to continue to access and modify the values of the variables after the routine has exited.