lua-users home
lua-l archive

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


 I find this macro pretty useful in my Lua code to be sure that my functions
work with absolute and relative indexing...

  #define abs_index(L, i) \
	((i) > 0 || (i) <= LUA_REGISTRYINDEX ? (i) : \
	lua_gettop(L) + (i) + 1)

 How about including it into the lauxlib.h or maybe lua.h?

  Tom Spilman
  Co-owner | Programmer
  www.sickheadgames.com