[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Memory usage stats for 5.2 vs 5.3
- From: Sean Conner <sean@...>
- Date: Tue, 13 Jan 2015 14:29:12 -0500
It was thus said that the Great Tom Sutcliffe once stated:
> > Because you can store binary data in strings. E.g., you could move
> > an entire struct to a string and then type-cast the string back
> > to the struct. But of course the idea would be not to waste space
> > with that.
> Hmm I suppose you could do that with the Lua C API, it wouldn't have
> occurred to me that anyone would want to though, given that's what
> userdata is for! I guess that's one of those situations where I'd happily
> restrict it if it were just for me, but in base Lua you can't risk making
> such assumptions.
It's useful when you receive data from a network connection. If the data
is sent aligned, then it's easy to pull the fields out without much
overhead (reading byte-by-byte and reconstructing 16 and 32 bit values).