Skip to content
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

A var_dump library #6

Open
utkarshkukreti opened this issue Aug 13, 2012 · 8 comments
Open

A var_dump library #6

utkarshkukreti opened this issue Aug 13, 2012 · 8 comments

Comments

@utkarshkukreti
Copy link
Contributor

There are several floating around on the internet.

Has anyone tried any? I don't remember which, but I tried 3 and only 1 worked, rest crashed the player on some objects.

Any recommendations?

@Yonaba
Copy link
Member

Yonaba commented Aug 13, 2012

What types do you need to be dumped ? If it all about strings, tables, and numbers, i can work on one.
By dump, I assume you mean serialize ? That is, save the input data as a string, to be restored back later in its original form.

@utkarshkukreti
Copy link
Contributor Author

Nope, not serialize. Like the PHP's var_dump does, for debugging.

We should probably have some parameters to limit the amount of information printed. Like name of methods or not (I think this is possible?).

@Yonaba
Copy link
Member

Yonaba commented Aug 13, 2012

Okay, I get it.
So, it must be able to recognize all Lua primitives types. Are there some others needed ?
Have you any specific suggestions for parameters it should handle ?

@utkarshkukreti
Copy link
Contributor Author

I'm not that good with Lua yet. What are other types? Isn't everything except strings and numbers, tables?

Something like this perhaps (for tables)

-- these could be the defaults
var_dump(a_table, { depth = -1, methods = false, variables = true }) -- -1 = infinity

@Yonaba
Copy link
Member

Yonaba commented Aug 13, 2012

Lua has 8 primitive types. See LuaTypes
Well, I may work one something for that purpose, if you want. Probably this evening, actually I am kind of busy.

@utkarshkukreti
Copy link
Contributor Author

Well actually, I don't think parameters are of much use.

@utkarshkukreti
Copy link
Contributor Author

Here are some similar methods (And I think all of them also support serializing back).

@ar2rsawseen
Copy link
Member

I've always used print_r from that page, worked liked charm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants