I'm trying to create a SWIG typemap for the following function:
void mix(int size, float *in1, float *in2, float *out1)
{
for (int i = 0; i < size; ++i)
out1[i] = in1[i] + in2[i];
}
In lua, I want this function to take 2 table arguments and return 1 table like the following:
local t = m.mix({1,2,3}, {4,5,6})
Then the table t
should be {5,7,9} which is sum of the two tables.
I tried to use built-in typemaps but I could only wrap a function that takes and returns one table which is the following:
%apply (float *INOUT, int) {(float *inout, int size)};
How can I create a SWIG typemap for a function that takes two tables and returns one table?