Category | Scripting |
Created | 27.04.2017 16:32 |
Tim Derks (timmiej93) | 27.04.2017 16:36 |
---|---|
I want to overwrite a function, that already has a superFunc in its arguments, which to me indicates that it already has been overwritten. I do want to call the function I'm overwriting, so I do need it. I've tried doing this: Original: function test1 (superFunc, argument1, ...) blabla superFunc() end Mine: function test2 (superFunc, superFunc2, argument1, ...) blabla superFunc(superFunc2, argument1, ...) end In my test2 function, I want to do some things, and in some cases, call test1. Is it correct to call superFunc(superFunc2, ...), or should it be the other way around? I've been playing around with a test script, but it gives some confusing results. Tim |
Emil Drefers (Unknown) | 28.04.2017 07:01 |
---|---|
Hi, this one: function test2 (superFunc, superFunc2, argument1, ...) looks wrong to me. If your function overwrites any other function it still has only one 'superFunc' So: function test2 (superFunc, argument1, ...) should be the right argument list for your function. Note: When you call a 'superFunc' you need to pass the object. Mostly that looks like: function MySpecialization:myFunction(superFunc, arg1, ...) superFunc(self, arg1, ...) end You could check the SpeedRotatingParts.loadSpeedRotatingPartFromXML() https://gdn.giants-software.com/documentation_scripting.php?version=script&category=70&class=3513#loadSpeedRotatingPartFromXML47510 This function is overwritten by several Specializations. e.g. AnimatedVehicle https://gdn.giants-software.com/documentation_scripting.php?version=script&category=70&class=3408#loadSpeedRotatingPartFromXML46190 Foldable https://gdn.giants-software.com/documentation_scripting.php?version=script&category=70&class=3479#loadSpeedRotatingPartFromXML46952 any many more ... Cheers, Emil |
Tim Derks (timmiej93) | 28.04.2017 22:08 |
---|---|
Hm, interesting, I'm gonna have to do a bit more research on that then, since my first argument -after- 'superFunc' became a function value after I overwrote an overwritten function, it seemed like all moved over a step. Thanks anyway Emil |
Note: Log in to post. Create a new account here.