Re: ffi - C array to lua table ?

  • From: demetri <demetri.spanos@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Sat, 11 Jul 2015 13:14:40 -0700

Well I meant more strait forward than [procedural implementation]


I would offer two thoughts here:

1) the "Lua-culture" solution would be for people who want such a thing
to stick those 4 lines in a function called table.from_array. In general,
Lua
has a "few built-ins, maximal freedom for DIY to taste" design culture
(which
has strengths and drawbacks, of course, especially for newcomers). In this
sense it is very different from cultures like Python or Java.

2) I speculate that the reason there is no built-in for this particular use
is
because it goes in the opposite direction of what you typically want from
built-ins (i.e. you're asking to go from a more specialized structure to a
less
specialized structure, which is easy to DIY fairly efficiently).

Demetri

Other related posts: