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.