[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Suggestion: let string.unpack support userdata
- From: Sean Conner <sean@...>
- Date: Tue, 21 Feb 2017 13:24:11 -0500
It was thus said that the Great 云风 Cloud Wu once stated:
> string.unpack is a power tool to process the binary data. Sometimes, we use
> userdata as a string (binary data) buffer. I think if string.unpack support
> userdata as parameter would be better for this case.
>
> And, if the userdata is a C struct, we can simply use string.unpack to
> extract the data from the C struct, otherwise we should copy it (by
> lua_pushlstring) to a string first.
http://lua-users.org/lists/lua-l/2014-08/msg00720.html
It's part of a much larger thread about using userdata as strings. I
realize that what you are proposing isn't quite the same as the above
thread, but that particular message is probably worth repeating here.
-spc