-
-
Save ripter/4270799 to your computer and use it in GitHub Desktop.
Added check for boolean.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Print contents of `tbl`, with indentation. | |
-- `indent` sets the initial level of indentation. | |
function tprint (tbl, indent) | |
if not indent then indent = 0 end | |
for k, v in pairs(tbl) do | |
formatting = string.rep(" ", indent) .. k .. ": " | |
if type(v) == "table" then | |
print(formatting) | |
tprint(v, indent+1) | |
elseif type(v) == 'boolean' then | |
print(formatting .. tostring(v)) | |
else | |
print(formatting .. v) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks alot!