lua-users home
lua-l archive

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


Hi. I don't know how to use tolua to instantiate structs (not objects) in my lua scripts.
Take for instance this pkg file:
 
typedef struct {
    char    *cclib_name;          /* Must match CCLib name in gcprod */
    void    *cclib_data;
} CCLIB_START_STRUCT;
 
in my lua script, I do:
 
local p = CCLIB_START_STRUCT
p.cclib_name = "test"
 
but when I try to set the cclib_name field, I get: "invalid 'self' in accessing variable 'cclib_name'"
How do you create a variable of the above type and initialize it? I tried with the type:new() sintax, but it seems that's only for classes.
 
Greetings
Ignacio Burgueño