Am 17.09.2015 um 16:24 schröbte 曹煦:
Sorry for the misleading conclusion.
The truth is that the broken code still crash under 5.1.5. However，it
happened to work fine after I inserted some lua_checkstack() calls
before those luaL_register(), which only work fine with lua5.1.5
(the code still crash under 5.1.4). So I simply thought it’s caused
by the lua version.
Maybe the problem still is with the "some lua_checkstack() calls". I can get to 7998 successful `luaL_register()` calls on Lua 5.1.4 before Lua raises an error. Valgrind can't find anything out of the order either. This is on Linux, though.