lua-users home
lua-l archive

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


----- Original Message ----- 
From: "Wim Couwenberg" <w.couwenberg@chello.nl>
> int abs_index = lua_gettop(L) + neg_index + 1;
>
> Bye,
> Wim
>

I wonder why such a macro is not in the API, I need it for almost every C
function which receives a stack index as parameter, to ensure it stays
valid.

Well, I'll add it to my library of "missing features" ;-)

#define lua_absindex(L,n) ((n) < 0 ? lua_gettop(L) + (n) + 1 : (n))