how to wrapper a c function whose parameters are a point to struct so that it can be called by lua s

Posted by pierr on Stack Overflow See other posts from Stack Overflow or by pierr
Published on 2010-03-26T05:06:31Z Indexed on 2010/03/26 5:13 UTC
Read the original article Hit count: 220

Filed under:
|
|

Hi,

I have follwing C function. How should I wrapper it so it can be called by lua script?

typedef struct tagT{
    int a ; 
    int b ;
}type_t;

int lib_a_f_4(type_t *t)
{
     return t->a * t->b ;
}

I know how to wrapper it if the function parameter type were int or char *. Should I use table type for a C structure? I am a lua beginner and thanks for help.

© Stack Overflow or respective owner

Related posts about lua

Related posts about c