lua-users home
lua-l archive

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


On Nov 21, 2012, at 12:18 PM, Rob Kendrick wrote:

> On Wed, Nov 21, 2012 at 07:03:36PM +0200, steve donovan wrote:
>> On Wed, Nov 21, 2012 at 4:49 PM,  <mchalkley@mail.com> wrote:
>>> I have to send and receive UDP packets containing unsigned shorts, for
>>> a diagnostic tool I'm writing.
>> 
>> How about Roberto's struct library?
> 
> I would have thought that if you have a string 's' containing the two
> bytes of the short, this is just fine:
> 
> 	x = (string.byte(s, 1) * 256) + string.byte(s, 2)

I find it comforting somebody else still thinks big-endian.