[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: 5.2: equality for closures
- From: Lorenzo Donati <lorenzodonatibz@...>
- Date: Wed, 29 Jun 2011 10:04:19 +0200
On 29/06/2011 9.57, steve donovan wrote:
On Wed, Jun 29, 2011 at 9:31 AM, Lorenzo Donati
So why it is not deemed useful to have the possibility to define custom data
types in this way directly in Lua (not using C API, I mean)?
It is very useful to have in the language - this is exactly what
LuaJIT's FFI is all about. Alien allows similar stuff with vanilla
Lua and allows you to manipulate buffers as userdata.
But it is tricky to bring such low-level stuff into a high-level
Aha! This really hit the spot! Now I see.
It's often easier just to do it in C, since the _actual
layout_ of a structure depends on so many things, endianness, word
size, alignment, and so forth. Something like Roberto's struct
library knows about this stuff and can be used to unpack a given bit
of binary data in Lua.
Things like fast binary arrays are possible but really belong in a library.
Thank you for the explanation!