lua-users home
lua-l archive

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


Hi guys,

Excuse me if this has been posted before but I cant find it in the archives.

I need to call a c function from lua that looks like this

bool Read(char *pData,unsigned int &iMaxSize);

The Read function will read some data of max iMaxSize and place it in
the pre-allocated pData char pointer, returns true on success or false
on failure.

My question is, how do I pre-allocate an array in Lua that I can use
to send into this C function? (without doing a for loop that adds
strings to a variable for example)

Best Regards,
Robert Aronsson