[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.4-work1 with first class arrays (implementation & benchmarks)
- From: Duane Leslie <parakleta@...>
- Date: Wed, 28 Mar 2018 22:03:23 +1100
> On 28 Mar 2018, at 20:46, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>
> I do see the point of arrays of bytes, or two-byte Unicode characters,
> or of floating-point numbers, etc, but those would be userdata, not
> tables. Using the same method names as the string and/or table
> libraries would of course be a sensible thing to do.
Where storage size matters (or has an impact on speed) I just use `string.unpack` to extract values from binary data. The associated `string.pack` is clumsy for editing, but if you've got something that is fairly constant it's not a problem. If single bytes will hold your data then just simply using `string.byte` is excellent value (a trick that I have used for state machine graphs in javascript where otherwise every number is a double).
Regards,
Duane.