Page 2 of 11
Re: Debug - A whole new way of debugging your game
Posted: Thu Feb 10, 2011 2:38 pm
by kikito
Taehl wrote:(on load, not every frame)
How about searching it only on tab keypress (for example)? You will already have the first characters to narrow the search.
One possible problem I see is metatables; following up the "inheritance" can be complex - and if __index is a function, probably impossible.
Re: Debug - A whole new way of debugging your game
Posted: Thu Feb 10, 2011 2:46 pm
by Taehl
Yeah, I guess that'd work. But I had in mind something more like the Source engine's console (it shows a list which updates while you type, not just choosing the closest function when a button is pressed).
Re: Debug - A whole new way of debugging your game
Posted: Thu Feb 10, 2011 3:19 pm
by kalle2990
vrld wrote:Curiously, recently I have done a similar thing:
https://github.com/vrld/love-console (attached .love for convenience). Though it is less suited for debugging but focused on live-coding (or stuff)
Looks nice
I really like that multiline input, seems promising, however I got stuck when writing something that errors. But as you said, it's not very well suited for debugging as I saw it removes broken functions, not very controversial for a debugging util
Re: Debug - A whole new way of debugging your game
Posted: Thu Feb 10, 2011 3:38 pm
by bartbes
kikito wrote:One possible problem I see is metatables; following up the "inheritance" can be complex - and if __index is a function, probably impossible.
And why would that be, they work for your search code as well.
Re: Debug - A whole new way of debugging your game
Posted: Thu Feb 10, 2011 3:49 pm
by kikito
bartbes wrote:kikito wrote:One possible problem I see is metatables; following up the "inheritance" can be complex - and if __index is a function, probably impossible.
And why would that be, they work for your search code as well.
__index as a function is "binary": it either returns nil, or it doesn't (returns an attribute/method/whatever). You can use that property to ask "is this method/attribute defined?" and get a truthy or falsy answer.
But __index (as far as I know) doesn't give you a "dictionary" - you can't ask it "give me all the methods that start with 'dra' ".
Re: Debug - A whole new way of debugging your game
Posted: Thu Feb 10, 2011 3:58 pm
by bartbes
Shouldn't next() find stuff in __index as well? I never meant calling it yourself..
Re: Debug - A whole new way of debugging your game
Posted: Thu Feb 10, 2011 4:01 pm
by kikito
bartbes wrote:Shouldn't next() find stuff in __index as well? I never meant calling it yourself..
If index is a table, yes (you will have to make it recursive, that table could have another __index metamethod). But if __index's a function, I don't see how.
Re: Debug - A whole new way of debugging your game
Posted: Thu Feb 10, 2011 4:20 pm
by bartbes
Hmm..
this is pretty interesting..
Re: Debug - A whole new way of debugging your game
Posted: Thu Feb 10, 2011 4:59 pm
by kalle2990
Version 1.1.5 released with some minor fixes
Re: Debug - A whole new way of debugging your game
Posted: Thu Feb 10, 2011 5:59 pm
by Robin
bartbes wrote:Hmm..
this is pretty interesting..
Makes sense. next() looks in the hash table. __index() is called when something isn't in the hash table. There is no way for next() to determine what keys __index() "accepts".