> STEP 1: Add a new header "lnbposix.h" to Lua.
This won't work for an important class of libraries known as "wrappers" or "bindings", i.e., libraries that expose (to Lua) the functionality of another library written in some other language. Even if the latter language is C or C++. With shared libraries this is just not possible, full stop.
With static libraries, you would have to modify a library that has nothing to do with Lua with something Lua-specific. First of all, this just does not look right conceptually. Second, the task might just be too difficult. Especially considering that those libraries might depend on more libraries, as is frequently the case.
So this approach is not "composable".
Cheers,
V.