lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sun, Feb 21, 2010 at 1:41 PM, Peter Smith <psmith135@gmail.com> wrote:
> It's almost working for me except that it apparently truncates the resulting
> string to 4 characters.
>   print ("USERDATA LENGTH: " .. bytes.len)
>   print ("CONVERTED LENGTH: " .. string.len(ud.as_string(bytes)))

I tested with some naive C code:

static int l_userdata (lua_State *L) {
    lua_newuserdata(L,lua_tointeger(L,1));
    return 1;
}

Which gives us a userdatum of the given size; and as_string()
correctly gives the length back.

It looks like this object is rather more complicated than what it
appears!  Although it provides a field to give its size (bytes.len)
this is not the size of the actual userdata, which is _probably_ a
pointer to some buffer. It's hard to say without access to Wireshark's
internals.

Are you sure that Wireshark is not exposing the required information
in some other way?

steve d.