[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Suggestion: let string.unpack support userdata
- From: 云风 Cloud Wu <cloudwu@...>
- Date: Tue, 21 Feb 2017 09:21:30 +0000
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.