lua-users home
lua-l archive

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

I don't really know anything about swig, but I would highly recommend
making the Lua interface 1-based as pretty much everything Lua assumes
this.  It's a shame about the disconnect, but that's how things are.


On Tue, Aug 5, 2008 at 1:11 PM, Joey Mukherjee <> wrote:
> I use SWIG to expose a few C++ classes to the user.  In the C code, I use
> zero-based arrays (obviously), but in the Lua code that interfaces with the
> C code, I also have to use zero-based arrays.  This seems somewhat unnatural
> for Lua programmers (right?).  I admit I don't program in Lua too much.
> Has anyone else had to deal with this issue?  Was it a big deal for your
> users to have both zero/one based arrays in their Lua programs?
> Is there a way to make SWIG convert all C++ vector uses to subtract one?  Is
> that even wise?  I'm guess I'm looking on thoughts on whether it is better
> to have all one based arrays with a Lua program, and if so, how do I do this
> easily with SWIG if it is even possible?
> Thanks,
> Joey
> P.S.  Thanks for the other help on the lua_isfunction and the stack count!