Jump to content




Adjust table output in Lua program


  • You cannot reply to this topic
3 replies to this topic

#1 HDeffo

  • Members
  • 214 posts

Posted 15 May 2016 - 06:43 PM

more nitpicking than anything so I doubt this will be considered but suggesting it none the less. The Lua program current serializes table output to make it easy to read. This is a really nice feature however due to the limited size constraints the tables quickly because unreadable by being pushed off the screen. I am suggesting instead it be changed to something like
print( textutils.serialize(output):gsub("\n","") )
now obviously that's not the cleanest solution and leaves a ton of needless spaces behind but its the easiest example of what I am suggesting. Essentially I believe the Lua program should try to condense the serialized tables as much as possible before printing so they are easier to read

Edited by HDeffo, 15 May 2016 - 06:43 PM.


#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 15 May 2016 - 11:29 PM

An alternative would be:

textutils.pagedPrint( serialised )

Granted scrolling might take a while for longer tables, but there's always Ctrl + T.

#3 Luca_S

  • Members
  • 407 posts
  • LocationGermany

Posted 16 May 2016 - 08:54 PM

Maybe something like a
textutils.compactSerialise()
function would be nice.

#4 Anavrins

  • Members
  • 775 posts

Posted 16 May 2016 - 09:26 PM

I'd say in the same style that serializeJSON(t, true) returns a different format, serialize(t, true) could return in a compact version.
Although, so far I've been using serialize(t):gsub("\n%s*", ""), the only issue with that is of course, any string value that contains \n will be affected.

Edited by Anavrins, 16 May 2016 - 09:44 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users