In lua, it's legal to do this :
table={}
bar
if(table[key]==nil) then
foo
However, using C API, I couldn't find way to check if there's a nil value on the specified position.
lua_getglobal(L,"table");
lua_gettable(L,key);
If there's a nil value stored in table[key], lua_gettable would give me the "unprotected error in call to Lua API (attempt to index a nil value)" message.
Is there any way to check if there's actually something associated with that key, before actually pushing the key to do so ?