Simplify and cleanup l_shelve_index()
Simplify and cleanup l_shelve_index()

* Use luaL_checkudata() to better check user data values.
* Remove unneeded call to lua_pop().
* Reorganize if-else blocks for clarity.

aperezdc/lua-shelve