Fix finding the extension type for Lua plugin

If the module's table had multiple extensions we would
leak the key and value on the stack.
Fix the global Lua plugin loader with multiple threads

LGI will yield to other threads when calling into C API.
This caused the return values for another thread's function
call to be on the Lua stack which caused an assertion.

This also adds multiple assertions that the thread's
Lua stack does not have any unpopped values.

https://bugzilla.gnome.org/show_bug.cgi?id=741859
Fix panic when getting global LGI fields

A panic will occur when using lua_getfield() as LGI
will attempt to find the value as a typelib. This breaks
the attempt to report an incorrect LGI version and
causes a crash.