Comments (4)
I think luaunit does something like that
https://github.com/bluebird75/luaunit/blob/master/luaunit.lua#L852
from inspect.lua.
Hi there,
I am not opposed to something like this, but I don't think I would activate it by default. It could be done by adding an extra option in the options
param. Or maybe making the options.newline
option accept a function with some parameters to decide this kind of thing.
I gave a quick look at luaunit and it wasn't clear to me that the keeponeline
variable worked as you say. It seems to me you must choose between "all in one line" (keeponeline=true
) or "all elements in a new line, even the short ones" (keeponeline=false
). There doesn't seem to be a way to "automatically deciding whether to keep things in one line or not depending on their length'.
What do you think? Would you consider making a pull request for this?
from inspect.lua.
I also had just a quick look to luaunit source, I'm not sure if the line I linked is the correct one, but luaunit works that way. This is some output form luaunit:
[...]
{
"knot",
"dragged_outside",
{"para", "He insisted that we hurried home to Savile Row"},
{"divert", "as_fast_as_we_could"}
},
{"knot", "as_fast_as_we_could", "glue", {"para", "as fast as we could."}}
Two objects, both have strings and objects inside, first one is multiline, second one is one-line.
I may try to do a pull request if I find some time, thanks :)
from inspect.lua.
Closing this for now, but feel free to send a PR if you want!
from inspect.lua.
Related Issues (20)
- custom __metatable metafield that is not nil or table breaks inspecting HOT 3
- Printing with metatable's "__tostring" if userdata has it? HOT 9
- Error when inspecting table returned by luaposix.dir HOT 3
- inspect does not render non printable values correctly HOT 7
- "Array"-style display option for tables HOT 2
- Error: attempt to compare number with nil HOT 3
- Can you please make metatables output optionally disablable? HOT 5
- Option to display strings with newlines as multi-line strings HOT 1
- Use dofile in Gideros HOT 1
- Looks strange with `inspect {{ x = 1 }}` HOT 3
- PERF: countCycles doesn't respect options.depth HOT 1
- No option to print lua table in one line HOT 1
- How to remove `<table id>`? HOT 2
- Lua crashes when inspecting _G HOT 6
- Idea: integration with middleclass HOT 1
- compat requirement unmentioned in installation guide HOT 1
- inspect option to output binary value as hex codes instead of escaped characters
- Use LuaBuffers in LuaJIT
- Typo in the examples, oops
- Buggy escape in smartQuote HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from inspect.lua.