-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Safe inspect version #46
Conversation
@@ -218,6 +218,30 @@ Gotchas / Warnings | |||
|
|||
This method is *not* appropriate for saving/restoring tables. It is meant to be used by the programmer mainly while debugging a program. | |||
|
|||
Safe inspect version | |||
==================== | |||
For cases when you need to print out whatsoever results of some function call you can use another version of `inspect` function: `safe_inspect`. Usage scenario example below: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you mean "whatever", not "whatsoever".
"safe" isn't really the right term here. And this seems like a very specific function for a very specific case. #39 can be addressed simply by wrapping the input in
It doesn't make sense to have an entirely new function instead of that. |
Use a table to wrap all the possible values returned by the function. Instead of:
Do this:
You can usually drop the two parenthesis of the call and just leave the brackets. This is equivalent to the previous one:
So |
For cases when you need to print out whatsoever results of some function call you can use another version of
inspect
function:safe_inspect
. Usage scenario example below:Result will be:
This allows to prevent primitive type handling errors when using original
inspect
function by just throwing away all the rest returned values if they are not of thetable
type otherwise using 2nd arg as parameters map likeinspect
function does.See issue: #39