This is the place for discussion and support for LunaLua and related modifications and libraries.
Moderator: Userbase Moderators
Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on topic/appropriate?
-Are you posting in the right forum/following the forum rules?
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Wed Jul 27, 2016 5:28 pm
Wrote this one night on my phone when I couldn't sleep about a week or two ago and decided to get back to it and finish it off. This API allows for simple debugging of variables, including variable types, miscallaneous values, and tables. It has three accessible functions shown below as well as an example and a screenshot of the example code at work. This API also modifies its values every tick and adjusts smoothly for changing numbers of debugged variables. It also has three error calls to help with troubleshooting. I think this could be pretty useful since it makes the debugging process when writing code a lot simpler and faster.
Now has a documentation with download: http://wohlsoft.ru/pgewiki/Debug.lua
Last edited by PixelPest on Thu Nov 03, 2016 1:27 pm, edited 3 times in total.
|
|
|
|
|
|
|
|
|
-
aero
- Palom

- Posts: 4787
- Joined: Fri Mar 28, 2014 2:51 pm
Postby aero » Wed Jul 27, 2016 5:49 pm
Does this really call for an entire API? This is could actually be a bit more difficult for people than debugging with just Text.print in a loop, because that doesn't require knowing how to use APIs and your specific methods.
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Wed Jul 27, 2016 6:00 pm
AeroMatter wrote:Does this really call for an entire API? This is could actually be a bit more difficult for people than debugging with just Text.print in a loop, because that doesn't require knowing how to use APIs and your specific methods.
Yes it does. One of its features is that it can print out the contents of tables and the y-positions of the debug text lines are also dynamic and accomodate for a changing number of variables/debug values, unlike when normally printing multiple lines of text
|
|
|
|
|
|
|
|
|
-
Hoeloe
- Phanto

- Posts: 1465
- Joined: Sat Oct 03, 2015 6:18 pm
- Flair: The Codehaus Girl
- Pronouns: she/her
Postby Hoeloe » Wed Jul 27, 2016 7:09 pm
PixelPest wrote:AeroMatter wrote:Does this really call for an entire API? This is could actually be a bit more difficult for people than debugging with just Text.print in a loop, because that doesn't require knowing how to use APIs and your specific methods.
Yes it does. One of its features is that it can print out the contents of tables and the y-positions of the debug text lines are also dynamic and accomodate for a changing number of variables/debug values, unlike when normally printing multiple lines of text
The changing y values isn't necessarily desirable. Let's say you're only printing booleans, and only printing some under certain conditions. If the number of values changes, then a bunch of the values will move around and it can make it difficult to track what the values are doing.
I'd still encourage the use of Text.print for the most part.
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Wed Jul 27, 2016 7:58 pm
Hoeloe wrote:PixelPest wrote:AeroMatter wrote:Does this really call for an entire API? This is could actually be a bit more difficult for people than debugging with just Text.print in a loop, because that doesn't require knowing how to use APIs and your specific methods.
Yes it does. One of its features is that it can print out the contents of tables and the y-positions of the debug text lines are also dynamic and accomodate for a changing number of variables/debug values, unlike when normally printing multiple lines of text
The changing y values isn't necessarily desirable. Let's say you're only printing booleans, and only printing some under certain conditions. If the number of values changes, then a bunch of the values will move around and it can make it difficult to track what the values are doing.
I'd still encourage the use of Text.print for the most part.
But due to the heading argument in the functions, they'll still be named the same things if you want them to be. I could consider adding a priority argument to the functions
|
|
|
|
|
|
|
|
|
-
Hoeloe
- Phanto

- Posts: 1465
- Joined: Sat Oct 03, 2015 6:18 pm
- Flair: The Codehaus Girl
- Pronouns: she/her
Postby Hoeloe » Wed Jul 27, 2016 8:20 pm
PixelPest wrote:
But due to the heading argument in the functions, they'll still be named the same things if you want them to be. I could consider adding a priority argument to the functions
While that is true, the problem is that these values will often be changing fairly frequently. Keeping track of changes is difficult if they keep jumping around the screen, even if you label them.
There are ways around this, but not really particularly elegant ways, and not using your API as it stands.
Even if this were fixed, the API is pretty minimal for what it does, and there aren't really many use cases for it that are simpler than just a Text.print.
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Wed Jul 27, 2016 8:37 pm
Hoeloe wrote:Even if this were fixed, the API is pretty minimal for what it does, and there aren't really many use cases for it that are simpler than just a Text.print.
Is there anything you can suggest that could be added to this to make it better? I'll look into adding priority slots to the API which shouldn't be too difficult, but is there anything else? Also, the reason I wrote this in the first place was to help debug my Blue Shell power-up code, since it is pretty long, and one of the main purposes of this is to not have to worry about the positions of the debug text lines (overlapping, large gaps, etc.)
|
|
|
|
|
|
|
|
|
-
Yoshi021
- Gold Yoshi Egg

- Posts: 691
- Joined: Thu Jan 21, 2016 9:06 pm
- Flair: :)
- Pronouns: He/Him
Postby Yoshi021 » Wed Jul 27, 2016 8:39 pm
PixelPest wrote: not have to worry about the positions of the debug text lines (overlapping, large gaps, etc.)
You can just use multiples of 16 when making vertical lists. Code: Select all Text.print(a,0,16*0)
Text.print(b,0,16*1)
Text.print(c,0,16*2)
Text.print(d,0,16*3)
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Wed Jul 27, 2016 8:43 pm
Yoshi021 wrote:PixelPest wrote: not have to worry about the positions of the debug text lines (overlapping, large gaps, etc.)
You can just use multiples of 16 when making vertical lists. Code: Select all Text.print(a,0,16*0)
Text.print(b,0,16*1)
Text.print(c,0,16*2)
Text.print(d,0,16*3)
This code uses multiples of 20 and yes I'm very well aware of that. But if you're debugging variables across a large section of code, it's easier to not have to remember what's what and what goes where
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Thu Aug 04, 2016 12:40 pm
Added a small update: objects are no longer required to have "" to not have a heading (although it is still supported), the field can just be left blank, as shown now in the example
|
|
|
|
|
|
|
|
|
-
Hoeloe
- Phanto

- Posts: 1465
- Joined: Sat Oct 03, 2015 6:18 pm
- Flair: The Codehaus Girl
- Pronouns: she/her
Postby Hoeloe » Thu Nov 03, 2016 2:39 pm
As a point of note, by the way, standard in SMBX 2.0 is the Text.warn function, which will display a message in red text at the top of the screen (like a console command line), including line number references and such. It also will only display with editor testing, so debug messages won't show in actual episodes.
I believe that actually covers a lot of the functionality of this API.
|
|
|
|
|
|
|
|
|
-
PixelPest
- Link

- Posts: 7111
- Joined: Sun Jul 12, 2015 5:38 pm
- Flair: Tamer of Boom Booms
-
Contact:
Postby PixelPest » Thu Nov 03, 2016 4:08 pm
I'm not exactly sure what the extent of Text.warn is so I can't accurately answer that. Can it debug tables though? That's the key feature of this API
|
|
|
|
|
|
|
|
|
-
Hoeloe
- Phanto

- Posts: 1465
- Joined: Sat Oct 03, 2015 6:18 pm
- Flair: The Codehaus Girl
- Pronouns: she/her
Postby Hoeloe » Thu Nov 03, 2016 4:24 pm
PixelPest wrote:I'm not exactly sure what the extent of Text.warn is so I can't accurately answer that. Can it debug tables though? That's the key feature of this API
Text.warn is basically like Text.print, but it pushes messages onto a queue, displays them for more than one frames, tells you the filename and line number they occurred, and will give you a printout when you end execution. The key thing about it is that it has no effect in episodes, only in the editor.
I'm not saying it does everything this does, only that it covers a lot of people's use cases.
|
|
|
|
|
Return to “LunaLua”
Users browsing this forum: No registered users and 0 guests
|