Best way of viewing a table's contents? [SOLVED]

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Sulunia
Party member
Posts: 203
Joined: Tue Mar 22, 2016 1:10 pm
Location: SRS, Brazil

Best way of viewing a table's contents? [SOLVED]

Post by Sulunia »

Hello folks!
So i've been recently messing around again with Love2D, and I was wondering, what's the best way of viewing a table's content?
I this case, what i mean is, you have a table. You don't know how deep it goes, how many tables within it has, and the fields it contains (such as "x", or "name", for example). You'd obviously go with a debugger, but what's the best option?
One of the options would be using BabeLua and VS2015, but that doesn't work for me, and i'm not sure ZeroBrane can do this.

What do you recommend? Has anyone ever had such trouble to deal with? :huh:
Last edited by Sulunia on Wed Mar 15, 2017 3:33 am, edited 1 time in total.
Don't check my github! It contains thousands of lines of spaghetti code in many different languages cool software! :neko:
https://github.com/Sulunia
MrFariator
Party member
Posts: 511
Joined: Wed Oct 05, 2016 11:53 am

Re: Best way of viewing a table's contents?

Post by MrFariator »

I have found rxi's lovebird very useful in this regard. Not only can you just dig into tables as though they're folders in some file management software, it also has a functional lua interpreter so you can punch in changes to the console and have them take place in your love2d project on the spot. Furthermore, you access it through your web browser, which makes it very portable so anyone who you give the code to can use it, too.

Of course, I imagine if you have very big number of entries in your tables it will certainly become cumbersome to use, and thus lose some of its usefulness.
Last edited by MrFariator on Wed Mar 15, 2017 2:35 pm, edited 1 time in total.
User avatar
Sulunia
Party member
Posts: 203
Joined: Tue Mar 22, 2016 1:10 pm
Location: SRS, Brazil

Re: Best way of viewing a table's contents?

Post by Sulunia »

MrFariator wrote: Wed Mar 15, 2017 12:41 am I have found rxi's lovebird very useful in this regard. Not only can you just dig into tables as though they're they're folders in some file management software, it also has a functional lua interpreter so you can punch in changes to the console and have them take place in your love2d project on the spot. Furthermore, you access it through your web browser, which makes it very portable so anyone who you give the code to can use it, too.

Of course, I imagine if you have very big number of entries in your tables it will certainly become cumbersome to use, and thus lose some of its usefulness.
That's actually pretty neat, just tested it out. Many thanks! It will definitely suffice for now.
Don't check my github! It contains thousands of lines of spaghetti code in many different languages cool software! :neko:
https://github.com/Sulunia
paulclinger
Party member
Posts: 227
Joined: Thu Jun 28, 2012 8:46 pm

Re: Best way of viewing a table's contents? [SOLVED]

Post by paulclinger »

Sulunia wrote: Tue Mar 14, 2017 11:14 pm So i've been recently messing around again with Love2D, and I was wondering, what's the best way of viewing a table's content?
I this case, what i mean is, you have a table. You don't know how deep it goes, how many tables within it has, and the fields it contains (such as "x", or "name", for example). You'd obviously go with a debugger, but what's the best option?
One of the options would be using BabeLua and VS2015, but that doesn't work for me, and i'm not sure ZeroBrane can do this.

What do you recommend? Has anyone ever had such trouble to deal with? :huh:
ZeroBrane Studio can definitely do this: you can either view the values in the stack window (if it's in one of the local variables or an upvalue) or you can see it in the Watch window. Just set the expression to the table name and it will show you the values in the table. You can also expand the values and not only view them, but update them as well in any of the sub-tables.

You can also use one the fields or even functions as expressions, but keep in mind that expressions are re-evaluated after each stop in the debugger (to make sure they are up-to-date).
Post Reply

Who is online

Users browsing this forum: Bobble68 and 82 guests