Lua C libraries built against Lua 5.1 expect the Lua 5.1 ABI, whereas C programs which use Lua 5.2 expect the Lua 5.2 ABI. These two ABIs are significantly different, meaning that 5.2 programs cannot
twoface is a DLL which consumes the 5.2 ABI and presents a 5.1 style ABI, thereby allowing a 5.2 program to load most 5.1 C libraries without the need for any recompilation.
LUA_GLOBALSINDEXcan increase stack usage by one slot, which will cause problems for libraries which (wrongly) already used all of Lua's "internal" slots.
lua_setfenvon threads instead gets/replaces
lua_setfenvfails on C closures which weren't created by twoface, and on Lua functions which don't report an
_ENVupvalue. For such functions,
lua_getfenvwill return something, but it might not be accurate.
lua_setfenvon a Lua function may affect more than just one closure.
lua_loadexpects Lua 5.2 source code.
lua_dumpwork with Lua 5.2 bytecode rather than Lua 5.1 bytecode.
LUA_HOOKTAILREThas been swapped for
luaopen_basewon't load the