From: Charlie Wood <charlie@ur...> - 2007-07-23 16:58:46
In a C library I'm wrapping for lua I have several functions which
returns a string using the common C paradigm of passing in a pointer
to a buffer and a size. For example, creating a string representation
of an object, with the C return value providing a status or return
int foo2string (foo_t obj, char *buffer, size_t len)
I'd like to wrap this such that it returns a status and a native string:
> x = new_foo_t ()
> status,s = foo2string (x, 12)
but I can't figure it out. I'm shifting from python to lua, I can do
this in python quite happily, so it may be that I'm simply still
thinking too much in python mode.
Can anyone offer any suggestions?
Apologies if this has cropped up before, I tried to search the
archives but the SF servers were playing silly bu**ers with me.