swig lua设置获取元素数组。

如何生成一个类型映射来处理浮点数数组的设置和获取。我有以下结构:

typedef struct
{
    float p[2];

} Point;

我应该在我的swig接口文件中写什么,才能在Lua代码中编写以下内容:

MyPoint.p[1]= 123.456
print(MyPoint.p[1])

我尝试了这里的解决方案:

SWIG how to access a byte array from a c struct in Lua using a Lua table to manipulate

但对我不起作用...

点赞