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

"Array"-style display option for tables #43

Closed
speeditor opened this issue Dec 20, 2018 · 2 comments
Closed

"Array"-style display option for tables #43

speeditor opened this issue Dec 20, 2018 · 2 comments

Comments

@speeditor
Copy link

speeditor commented Dec 20, 2018

Firstly, I'd like to thank Kikito for producing this module. It's incredibly convenient for debugging, and it's literally invaluable to me in many cases (with metatables, or testing in restricted environments).

Currently the module outputs tables in this format:

{ "1", "2", [5] = "5", [6] = "once I pcall(A_FISH, ALIVE)" }

My suggestion is an option to display that table like this:

{ "1", "2", nil, nil, "5", "once I pcall(A_FISH, ALIVE)" }

Maybe options.array conditional?

Beyond the slight minification, the user could remove the brackets from the inspected table string. This produces a valid unpacked "array" (an arguments list!). So in a roundabout way, this could be useful for test units etc. (anything that needs to turn a static table into an arguments list).

Here's an example of this working well in the Chrome browser console (I feel JS shouldn't allow this kind of behaviour, but that's another story ;D).
image

@speeditor
Copy link
Author

speeditor commented Dec 28, 2018

@kikito thoughts? Pinging in case this library was considered feature complete in 2017. I do understand if this kinda feature is impossible, or needs too much refactoring (if any is welcome at this point).

@kikito
Copy link
Owner

kikito commented Sep 23, 2021

Hi, I have decided not to include this.

In Lua, "arrays" (called sequences) are defined as "not having holes" in Programming In Lua (I can't find the exact part now). The way I interpret this is that first nil, and everything after is is not part of the sequence. The library reflects this opinion.

Please feel free to add that feature to your own fork. I will not be implementing this feature.

@kikito kikito closed this as completed Sep 23, 2021
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

2 participants