lua-users home
lua-l archive

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


> I'm having trouble figuring out tolua 3.2.  Using the pkg file below, why
> isn't valid C code generated?  (Problem seems to be caused by the
> "unsigned".)

> --- test.pkg ---
>    $#include "test.h"
>
>    typedef struct {
>        int a;
>        unsigned int b;
>        int c;
>    } abc;
>
>    void func( abc* );
> ------

You are right, it's really a bug. I'll fix it for the next version.
You can work around omitting the "int" after the "unsigned".

> Secondly, how do I create an instance of my structure from
>   Lua?
>

You can implement a C creator and include it in the .pkg file:

abc* create (void);

For C++, it would be enough to write:

var = abc:new ()

-- waldemar