Game Development Community

Script method argument names confusing?

by Michael Bacon · in General Discussion · 11/28/2007 (8:36 am) · 0 replies

I know I'm not the only one that initially found the script argument names confusing. Primarily when dealing with datablock methods. On top of that they are getting mixed around and misnamed and such by people who don't understand them or even people that do.

So I've been using a modified form of my own. Compare it to the standard class function definition. I feel it makes code easier to migrate between object and datablock and will impart a better understanding to anyone unfamiliar who is reading.

function MyDatablock::myCallback(%datablock, %this) { }

function MyClass::myMethod(%this) { }

// example of pure datablock call
function MyDatablock::myDatablockMethod(%datablock) { }

I dislike the use of the %obj or %object naming of %this. It probably has to do with my C++/Java background. Just tell people '%this' is always the object being referred to unless there is no %this in which case it would be a pure datablock call.

Edit: As an option when I'm feeling lazy I use %db instead of %datablock