lua-users home
lua-l archive

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


Asim wrote:
I want to write a C function that returns a sequence of bytes. This
function should be called from Lua. There are two options for the type
of return value in Lua - userdata and string.

I'd make that depend on whether you want to be able to change single bytes after the data was initially returned. A Lua string has to stay constant (when you want to change a byte, Lua creates a new string), an userdata can act however you want.

If the data is constant, I would use a string as it is less work.

-- David