Wow, I am on a roll today for poor error checking. I introduced an error in the last case by trying to clean it up for the list. Here is the correct output and script: $ lua anchor_corrected.lua Constructing without any anchoring [Greetings dear friends! I am (0x0004ce48)!] ---Forcing GC [Alas! I, (0x0004ce48), have been collected.] Constructing with function-local anchoring [Greetings dear friends! I am (0x000431d0)!] ---Forcing GC The object sthould still be alive. Releasing local anchor [Alas! I, (0x000431d0), have been collected.] Constructing with function-local anchoring ... but not storing returned reference in caller scope [Greetings dear friends! I am (0x00049250)!] ---Forcing GC [Alas! I, (0x00049250), have been collected.] Constructing with caller-local anchoring [Greetings dear friends! I am (0x00043a30)!] ---Forcing GC Releasing caller anchors and forcing GC [Alas! I, (0x00043a30), have been collected.] Fin
Attachment:
anchor_corrected.lua
Description: Binary data