| Blockland Forums > Modification Help |
| Is it possible to overload functions in TorqueScript? |
| (1/1) |
| Cajetan:
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.) |
| Zloff:
Do you mean 'overwrite'? If so then yes |
| Headcrab Zombie:
No, you can't, it will just overwrite it. However I do have a few functions that imitate it: --- Code: ---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 } --- End code --- Of course this becomes annoying with more than a few arguments |
| Cajetan:
--- Quote from: Headcrab Zombie on November 13, 2011, 02:34:08 PM ---No, you can't, it will just overwrite it. However I do have a few functions that imitate it: --- Code: ---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 } --- End code --- Of course this becomes annoying with more than a few arguments --- End quote --- Ah thank you. |
| Navigation |
| Message Index |