lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi
 
I have been using Swig to implement some Lua - C bindings. It works fine for most of the things I need to bind, but I am stumped on how to make it bind the following..
 
An array within  a struct
An array of structs
 
struct MY_SMALLSTRUCT
{
   int var1;
};
 
struct  MYSTRUCT
{
   int var1;
   int var2[10];
};
 
struct MYSTRUCT myStructA;
struct MY_SMALLSTRUCT mySmallStructA[2];

The SWIG examples dont seem to help with these 2 constructs, has anyone got any examples or tips on how to use SWIG to bind these  ?
 
I guess if SWIG cant easily handle this, as a fallback solution I could use manual bindings, but my experience with the API is very limited and those 2 constructs might well defeat me too. (My real world example structs I need to bind will be much bigger than the above simple examples)
 
Has anyone got any manual binding examples for these constructs that they would be willing to share please ?
 
Thanks
 
    Geoff