On 21 February 2010 18:10, steve donovan <
steve.j.donovan@gmail.com> wrote:
> On Sat, Feb 20, 2010 at 11:58 PM, Peter Cawley <
lua@corsix.org> wrote:
>> functions, etc. To get the contents of a userdata, you need to use the
>> C functions designed specifically for that userdata, which in turn
>> employ the base C API function lua_touserdata to get memory access to
>> the userdata.
>
> An interesting possibility is a small C extension which can work with
> arbitrary userdata as memory buffers, rather like how Alien works with
> buffers. One could define a userdata-to-string converter, bearing in
> mind that Lua strings can contain embedded nuls and then use one of
> the struct, pack, etc libraries to decode that string.
>