Global functions: How robust is Papyrus for same name functi

Post » Mon Jun 18, 2012 6:49 pm

OK, in most programming languages, I could create two global functions with the same name but different passed values, and they would all work fine and independently, because the language checks the types being passed and uses the right one.

An example:
scriptname MyDataType extends form...int function AddAndDivide(int A,int B, int C) globalif C != 0   return ((A+B)/C) as intelse   debug.MessageBox("Attempt to divide by zero in AddAndDivide Integer function")endifendfunctionfloat function AddAndDivide(float A,float B, float C) globalif C != 0.0   return ((A+B)/C)else   debug.MessageBox("Attempt to divide by zero in AddAndDivide float function")endifendfunction

And the program would pick the correct one, returning an integer value if it is passed integers, and a float value if passed float values.

What I'm worried about is accidentally picking the same name as an existing global function in some other script somewhere, and having conflicts.
User avatar
Allison Sizemore
 
Posts: 3492
Joined: Wed Jul 19, 2006 6:09 am

Return to V - Skyrim