[LUA] PrintTableDepth

A small script I came up with as I wanted to print the weapon table and noticed its too large for the console (at least on metaconstruct). So I made my own PrintTable function where you can define how much you want to print.
Then I just made look nicer and so that you just could copy paste it from the console into a lua file.
Hope you’ll also find it useful when needed.


EDIT2: Now represents the keys as their actual type. Added type(s): Entity, Weapon and Player

Example Output:


Edit: fixed an error that’d occur when a variables type is not listed

You should submit this to the GitHub; this is a very useful function.

Ok thanks but which GitHub and how?

I wonder if this can print all of _G into the console, because I had to print all of _G into a file because it was too big to actually print out and I wanted to proxy everything that went into _G when making an anti-cheat. Thanks for this, though.

I like how it formats the table and makes it easier to understand

Looks like you’re representing numerical keys as strings

Ok thanks updated it also in the first post.

Now with Entity support:

Why c-style comments?

Please don’t use pastebin it breaks the indentation and it looks dirty, gist works fine.

@FPtje: I don’t really care about the comment type as long as they’re working. But this one uses the least amount of characters as far as I know.

@_FR_Starfox64: Thanks until now I just knew pastebin and it always did a good job. I added gist links under every pastebin I posted.

Glad I’m not the only one who doesn’t want to see c-style comments in lua…