Author Topic: Is it possible to overload functions in TorqueScript?  (Read 934 times)

Like in C++ using the same function's name just another parameter... Is that possible in TorqueScript? If yes that would be great. (Im actually talking about the one Blockland uses.)

Do you mean 'overwrite'? If so then yes

No, you can't, it will just overwrite it. However I do have a few functions that imitate it:

Code: [Select]
function example(%a,%b)
{
if(%b $= "")
//The user only provided one argument, so do one thing
else
//The user provided two arguments, so do another
}
Of course this becomes annoying with more than a few arguments
« Last Edit: November 13, 2011, 02:45:00 PM by Headcrab Zombie »

No, you can't, it will just overwrite it. However I do have a few functions that imitate it:

Code: [Select]
function example(%a,%b)
{
if(%b $= "")
//The user only provided one argument, so do one thing
else
//The user provided two arguments, so do another
}
Of course this becomes annoying with more than a few arguments

Ah thank you.