src/main/c/jnlua.c
static int validindex(lua_State *L, int index) {
	int top;

	top = lua_gettop(L);
	if (index <= 0) {
		if (index > LUA_REGISTRYINDEX) {
			index = top + index + 1;
		}
		else {
			switch (index) {
			case LUA_REGISTRYINDEX:
			case LUA_ENVIRONINDEX:
			case LUA_GLOBALSINDEX:
				return 1;
			default:
				return 0; /* C upvalue access not needed, don't even validate */
			}
		}
	}
	return index >= 1 && index <= top;
}
/* ---- Checks ---- */
/* Returns whether an index is valid. */
Checks
Returns whether an index is valid.
Checks Returns whether an index is valid .
static int validindex(lua_State *L, int index) {
	int top;
	top = lua_gettop(L);
	if (index <= 0) {
		if (index > LUA_REGISTRYINDEX) {
			index = top + index + 1;
		}
		else {
			switch (index) {
			case LUA_REGISTRYINDEX:
			case LUA_ENVIRONINDEX:
			case LUA_GLOBALSINDEX:
				return 1;
			default:
				return 0; 
			}
		}
	}
	return index >= 1 && index <= top;
}
static int validindex ( lua_State * L , int index ) { int top ; top = lua_gettop ( L ) ; if ( index <= 0 ) { if ( index > LUA_REGISTRYINDEX ) { index = top + index + 1 ; } else { switch ( index ) { case LUA_REGISTRYINDEX : case LUA_ENVIRONINDEX : case LUA_GLOBALSINDEX : return 1 ; default : return 0 ; } } } return index >= 1 && index <= top ; }
Checks 
Returns whether an index is valid.
Checks Returns whether an index is valid .
/* C upvalue access not needed, don't even validate */