GithubHelp home page GithubHelp logo

Comments (4)

1bardesign avatar 1bardesign commented on June 20, 2024

There is stringx.pretty which may suit your needs? It is currently not safe to use on tables that may contain cyclic references though (you'll get a stack overflow).

from batteries.

TurtleP avatar TurtleP commented on June 20, 2024

Yeah, just tried it on a table and got a stack overflow. If this (the issue I raised) was (part of) the intended use of stringx.pretty, I guess it's okay, but it wasn't immediately obvious to me I suppose. Only thing is I guess having it not stack overflow? Not sure what's causing that on my end, but hopefully I can figure it out.

from batteries.

1bardesign avatar 1bardesign commented on June 20, 2024

A stack overflow with stringx.pretty is caused by a cycle of references within the table.

local a, b ={}, {} 
a.cycle, b.cycle = b, a
stringx.pretty(a) -- stack overflow

This is a known issue in stringx.pretty that needs tracking of all already-printed tables in a call.

A method to print using stringx.pretty instead of tostring each argument could be added - in that case I'd probably change to a separate pretty module with string and print functions

from batteries.

1bardesign avatar 1bardesign commented on June 20, 2024

See https://github.com/1bardesign/batteries/blob/master/pretty.lua 🎉

from batteries.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.