stop/start inspection and direct print options #42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Keep / discard / improve - Just sharing if you are interested...
Test...
-- Variables
local extensions = {"png", "bmp", {["jpg"] = 1, ["jpeg"] = 2}}
-- Code
print(inspect(extensions)) -- "A"
print(inspect(extensions, {wait = true})) -- "B"
print("C: Inspecting 'extensions': " .. inspect(extensions)) -- "C"
print(inspect(extensions, {start = true})) -- "D"
print("E: Inspecting 'extensions': " .. inspect(extensions, {wait = true})) -- "E"
inspect(extensions, {wait = true, doprint = "F: Inspecting 'extensions'..."}) -- "F"
inspect(extensions, {wait = true, doprint = "" }) -- "G"
inspect({},{stop = true}) -- "H"
inspect( extensions, {wait = true, doprint = "I: This should not inspect"}) -- "I"
for i=1,4 do -- "J"
if i == 3 then inspect(,{start = 1}) else inspect(,{stop = 1}) end -- "K"
inspect( extensions, {wait = true, doprint = "L: Inspecting 'extensions' (" .. i .. ")..." } ) -- "L"
end
Output...
{ "png", "bmp", {
jpeg = 2,
jpg = 1
} }
did not inspect - waiting for a start
C: Inspecting 'extensions': { "png", "bmp", {
jpeg = 2,
jpg = 1
} }
inspect enabled
E: Inspecting 'extensions': { "png", "bmp", {
jpeg = 2,
jpg = 1
} }
F: Inspecting 'extensions'...
{ "png", "bmp", {
jpeg = 2,
jpg = 1
} }
{ "png", "bmp", {
jpeg = 2,
jpg = 1
} }
L: Inspecting 'extensions' (3)...
{ "png", "bmp", {
jpeg = 2,
jpg = 1
} }
Commentary...
A: Original way still works
B: Will only work when called after a call with start=true [note: status message added when using the original way]
C: Original way still works [only usage with wait enabled can get blocked]
D: Enable all subsequent wait enabled calls [Does not inspect the element / bonus status message when using the original way]
E: Basically the same as 'C' but it will now work because a start has been done [unlike 'B' which was blocke]
F: Basically the same as 'E' but using the new doprint option
G: Basically the same as 'E' but using the new doprint option with no preamble
H: Stop further inspections [absolutely nothing prints as opposed to 'D']
I: Inspection blocked just like 'B' [but absolutely nothing prints unlike 'B']
J: One situation where the new options can really help follows...
K: Start and stop selectively [using simplest option settings with absolutely nothing printing]
L: Thanks to 'K' it only inspects the chosen instance [3] !!!
Notes...
PS...
Thanks for sharing the original!