lua-users home
lua-l archive

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

2011/11/15 Tim Caswell <>:
> Well, it seems this works for most callbacks, but not all.  In the
> docs I see it says it doesn't work with "functions with pass-by-value
> aggregate argument or result types".  I'm not sure what that means.

It means that if the function take some arguments in the form of
structs passed by values LuaJIT cannot accept them. The same holds
true in the function returns a struct.

For examples the following functions will be not accepted:

struct point {
  float x;
  float y;

/* not ok, struct passed by value */
void my_function_1(struct point a, struct point b);

/* not ok, returns a struct */
struct point my_function_2(float x, float y);

> Am I doing something wrong, or is this kind of function not supported?

The returned value is uv_buf_t which is defined as follows:

typedef struct {
  char* base;
  size_t len;
} uv_buf_t;

so it doesn't work.