diff options
Diffstat (limited to '3rdparty/genie/src/base/io.lua')
-rw-r--r-- | 3rdparty/genie/src/base/io.lua | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/3rdparty/genie/src/base/io.lua b/3rdparty/genie/src/base/io.lua index 9ebc03d07e8..11c2a28924d 100644 --- a/3rdparty/genie/src/base/io.lua +++ b/3rdparty/genie/src/base/io.lua @@ -15,22 +15,26 @@ _esc = _escaper -- -- Prepare to capture the output from all subsequent calls to io.printf(), --- used for automated testing of the generators. +-- used for automated testing of the generators. Returns the previously +-- captured text. -- function io.capture() + local prev = io.captured io.captured = '' + return prev end -- --- Returns the captured text and stops capturing. +-- Returns the captured text and stops capturing, optionally restoring a +-- previous capture. -- - function io.endcapture() + function io.endcapture(restore) local captured = io.captured - io.captured = nil + io.captured = restore return captured end |