lua-users home
lua-l archive

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


The Lua binding I'm using for C++ classes removes the "self" parameter
from the stack.  It's always passed to the bound class, after type
checking.  This allows arguments to be referenced more naturally, with
the first argument at 1, rather than 2.

This causes a problem: it confuses luaL_argerror, since it expects the
self parameter to be there; it subtracts one, giving the wrong offset
for error messages (and "bad self" for errors on argument 1).

Any suggestions on how to deal with this?  I can't simply change that
function, since this only applies to arguments to these methods, not
library calls.  I don't want to simply not do this; in the context where
"self" has already been processed and passed as an argument, it's strange
to have to address the first argument as 2, and there are hundreds of
bound methods that would be affected.

-- 
Glenn Maynard