Re: Sequence of bytes - userdata or string?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Sequence of bytes - userdata or string?
- From: David Kolf <kolf@...>
- Date: 2012年1月04日 18:44:53 +0100
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