Snex Function  return an array

Do snex functions support returning a table?
I've been struggling.My attempt has an error:
Entire Snex Node Code:
template <int NV> struct Germanium1 { SNEX_NODE(Germanium1); // Define the WDFComponent class struct WDFComponent { // Function to calculate impedance (returns the magnitude of a complex number) double calculateImpedance(double real, double imag) { // Calculate the magnitude of the complex number return Math.sqrt(real * real + imag * imag); } // Function to connect to another WDFComponent void connect(double otherComponent, double portName) { // Placeholder } }; // Define the WDFCapacitor struct struct WDFCapacitor { WDFComponent base; // Base component double capacitance = 0.0; // Capacitance value }; // Function to calculate the impedance of the capacitor double calculateCapacitorImpedance(WDFCapacitor self, double sReal, double sImag) { float capacitance = self.capacitance; // Calculate the denominator: s * capacitance float denomReal = sReal * capacitance; float denomImag = sImag * capacitance; // Calculate the magnitude and angle of the denominator float denomMag = Math.sqrt(denomReal * denomReal + denomImag * denomImag); float denomAngle = Math.atan2(denomImag, denomReal); // Calculate the reciprocal of the magnitude float impedanceMag = 1.0 / denomMag; float impedanceAngle = denomAngle; // Convert back to rectangular form float impedanceReal = impedanceMag * Math.cos(impedanceAngle); float impedanceImag = impedanceMag * Math.sin(impedanceAngle); // Return the impedance values as a tuple return [impedanceReal, impedanceImag]; } // Function to connect the capacitor to another component float connectCapacitor(WDFCapacitor self, WDFComponent other, float portName) { // Implementation for connecting to another component Console.print("Connected to port: " + portName); } // Main function to test the WDFComponent class void main() { } // Initialise the processing specs here void prepare(PrepareSpecs ps) { // Run the main function // main(); } // Reset the processing pipeline here void reset() { } // Process the signal here template <typename ProcessDataType> void process(ProcessDataType& data) { } // Process the signal as frame here template <int C> void processFrame(span<float, C>& data) { } // Process the MIDI events here void handleHiseEvent(HiseEvent& e) { } // Use this function to setup the external data void setExternalData(const ExternalData& d, int index) { } // Set the parameters here template <int P> void setParameter(double v) { } };

@griffinboy In SNEX, arrays are
span
// init an array of type float and length 2 span<float, 2> realAndImg = {0.0f};
Then in the function
realAndImg[0] = impedanceMag * Math.cos(impedanceAngle); realAndImg[1] = impedanceMag * Math.sin(impedanceAngle); return realAndImg;
But it's not guaranteed error free

@griffinboy Oh yeah and since your returning a span, the fonction can't cast double.
You want to make your own typeusing MySpanType = span<float, 2>; MySpanType realAndImg = {0.0f}; // Function to calculate the impedance of the capacitor MySpanType calculateCapacitorImpedance() { // now you can return your span here }

@ustk
Woah.
Thank you very much.I haven't used advanced stuff like this before, I usually program very simple things up until this point!
I didn't even know you could do this stuff in hise! custom types? Structures? insane.
Thanks for your help, I now see that my reply in your latest forum post is completely useless, you know much more about this than me! Apologies.
Anyways, once I finish this script, I'll make a post about it and give away the code.
It's a framework for modular circuit emulation using Wave Digital Filters, which will allow you to string together any virtual circuit as long as you know the schematics. I'm planning on including premade components from famous units, starting with everything found in an amp. 
@griffinboy Oh no worries mate !
Yeah SNEX is C++ based > https://docs.hise.dev/scriptnode/manual/snex.html
So you can do pretty (all?) thing from C++, plus a layer of smart methods and shortcutsIf you're into WDF, why not going with Faust in the first place (within Scriptnode)? It's meant for WDF after all

Thanks for the recommendation I'm not really familiar with faust.
I'll look into it.Does faust support complex imaginary numbers?
That's somthing that I would need for sure.Edit*
Yeah faust seems a good route for the future.
It looks really neat for this kind of thing. But for now I will finish my model in snex, as there is a tight deadline on this project.If only I can figure out the snex syntax! The little differences between snex and C++ really trip me up.
It's maddening lol.Pointers not working lol