From: PatR Date: Thu, 19 May 2022 21:40:27 +0000 (-0700) Subject: lua 'index' X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=46e34b0826ec1142faa7483a00fea65acee302ac;p=nethack lua 'index' Having the preprocessor rename a variable called 'index' to one called 'strchr' is not the source of any bugs (in execution; it can cause pain when trying to ask a debugger to display the value and then be told no such thing exists). Change the name to 'indx' to avoid any confusion. If we switch to strchr() we should still avoid using 'index' as a variable name. --- diff --git a/src/nhlobj.c b/src/nhlobj.c index fa574ea2d..cb5390606 100644 --- a/src/nhlobj.c +++ b/src/nhlobj.c @@ -31,12 +31,12 @@ static int l_obj_bury(lua_State *); #define lobj_is_ok(lo) ((lo) && (lo)->obj && (lo)->obj->where != OBJ_LUAFREE) static struct _lua_obj * -l_obj_check(lua_State *L, int index) +l_obj_check(lua_State *L, int indx) { struct _lua_obj *lo; - luaL_checktype(L, index, LUA_TUSERDATA); - lo = (struct _lua_obj *)luaL_checkudata(L, index, "obj"); + luaL_checktype(L, indx, LUA_TUSERDATA); + lo = (struct _lua_obj *) luaL_checkudata(L, indx, "obj"); if (!lo) nhl_error(L, "Obj error"); return lo;