"Most query functions accept as indices any value inside the available stack space ..." [1] Would it be correct to say, "all functions which take a stack index require that it is inside the available stack space", or are there exceptions to this? I ask because functions such luaL_opt*[2] and luaL_check* [3] do not mention they require acceptable indicies and ones which are not acceptable result in undefined behaviour, whilst nearly all other functions that take indicies are noted they have a precondition of an acceptable index. For example if lua_gettop equals 0 luaL_checkany(L,-1) is undefined. or when stackspace equals X luaL_checkany(L,X+1) is undefined. [1] http://www.lua.org/manual/5.1/manual.html#3.2 [2] http://www.lua.org/manual/5.1/manual.html#luaL_optint [3] http://www.lua.org/manual/5.1/manual.html#luaL_checkany Liam