lua-users home
lua-l archive

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


Am 28.09.12 03:26, schrieb Tom:
> I'm sorry, but people seem have been missing the point of my question.
>  It is easy to implement a typed array for Lua; I have several such
> implementations myself (binding vector with luabind is one easy such
> implementation).  
> 
> The problem is that everybody is doing it differently.  Libraries that
> use large typed arrays (e.g., 3D graphics, image processing, etc.) each
> have their own typed array data types and it is impossible to move data
> efficiently from one to another without writing yet another extension.
> 
> Therefore, I think it would be good if there were a STANDARD for typed
> arrays, something that every extension that uses typed arrays can use as
> the basis for its own typed arrays, or at least provide conversions
> to/from.  That's the reason Python and JavaScript moved typed arrays
> into the core, and I think it would be good for Lua to consider doing
> this too. It doesn't need to have many (or even any) operations on it,
> but it does need a C API that is available and acceptable to all
> extension writers.

That API is alreday there and I use it heavily when I move data from/to
Lua.  It is the Lua C API where you can easily (and recusively, if you
want) iterate over the elements of a table, get the elements data type,
and act accordingly.