lua-users home
lua-l archive

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

Define a type for your buffer object:

int readstuff (MyBuffer* but, int len);

You will probably need to bind another function to create or access a buffer object:

MyBuffer* createbuffer (); or
MyBuffer* getbuffer();

-- Waldemar

On Oct 12, 2009, at 10:50 AM, Elbers, H.P. wrote:


I'm trying to use tolua++ to bind existing C++ code.

How to I bind a function like:
  int readstuff(void *buf, int len)

The caller has to supply a buffer where the function stores the data. In
this case buf must be able to contain len bytes, and the return values
is the actual nr of bytes tored in bug by readstuff.

Thanks, Hans

PS: if there is a better way to use C++ classes in a Lua script, id'
also be interested...