|
|
Pardon me if this has already been suggested.
Most macro writers could make the idiot-proofing of their macros much
more thorough by having a feature by which it is possible to test an
argument passed to the macro to determine if it is of the expected type.
Not only can this be used to give better feedback in an error message,
macro writers could also use it to make a macro more flexible for the
end user.
Here's one I though up just now:
#macro FunHouse(Paint)
#if(type(Paint)="texture")
#local txtPaint=Paint;
#else_if(type(Paint)="pigment") // yeah, the SDL could use an
// else-if statement, if it
// doesn't already have one
#local txtPaint=texture { pigment { Paint } }
#else
#debug "Invalid object passed as Paint parameter to FunHouse().\n"
#local txtPaint=texture { }
#end
union {
/// several objects here to make a fun house
texture { txtPaint }
}
#end
I suggest passing a string back only because it's more human-readable
for comparisons, and more easily allows for future expansion of the
feature (such as stating whether the object is an array of something, or
just a something).
Regards,
John
Post a reply to this message
|
|