Game Development Community

Tip - quickly find implementation of a ConsoleFunction/Method

by Orion Elenzil · in Torque Game Engine · 02/07/2008 (8:50 am) · 4 replies

Often i want to find where a particular console function or method is implemented,
but find-in-files can turn up an awful lot of results.

for example, searching for "getParent" returns about 140 results just in the C++ side.

an easy trick is to find-in-files for "getParent," (with a comma):
that returns exactly three results, all of which are ConsoleMethod declarations.

#1
02/07/2008 (9:52 am)
Ha! good tip Orion, thank you.
#2
02/07/2008 (10:03 am)
Using the find-in-files optional "use:" regular expression search feature can help alot :
console.*matan

trips on just one line:

ConsoleFunction( mAtan, F32, 3, 3, "(float rise, float run) Returns the slope in radians (the arc-tangent) of a line with the given rise and run.")
#3
02/07/2008 (10:13 am)
True, but in VisualStudio 2005 at least, i find that using even a simple reg-ex increases the search time by an order of magnitude.

ie, it's much faster for me if i were to search for just "matan", and then search in the search results themselves for "console".
#4
02/07/2008 (10:28 am)
Thanks for sharing Orion! Nice tip.

I use FileLocator Pro, a really good keyword search program for windows.

Like Matthew mentioned, using regular expressions (after finally figuring out how to use them) I can find things I'm looking for in the code and/or scripts pretty fast.

A couple I use a lot:

// This finds any ConsoleMethod or ConsoleFunction by the given name
(Console)(Method|Function).*(searchFunction)

// This finds the get...Whatever() function, when I can't remember what it was called. Handy! Whatever has "get" and "whatever" in the function call, it will return.
(Console)(Method|Function).*(get).*(whatever)

Although it's true most of the time I just do single keyword searches.

This is a cool thread. It would be nice to see more of these - tips & tricks people use in their daily development.