lua-users home
lua-l archive

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

LuaJIT FFI handles "C" types, and in "C" arrays start from 0.

The solution is to let your users be aware of this from the start.
No better solution than this.

On 6/13/2012 3:46 PM, Chris wrote:
On Wed, Jun 13, 2012 at 6:07 PM, Chris<>  wrote:
I suppose something to make the
FFI arrays one-based would work just as well.

After looking at the Lua libraries some more I think making Lua
zero-based might be too problematic.  If that's the case then making
LuaJIT's FFI interface one-based would be better.  So the ctype[1]
element would actually be the array[0] at the C level.  I believe a
while ago I looked into trying to make a change like that to LuaJIT
but it wasn't obvious how to do it.