diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2015-04-05 05:08:05 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2015-04-05 05:08:05 +0000 |
commit | 0ff13105f18931fa25caf08feb7a4cc6b52dd6f9 (patch) | |
tree | 16621bb36aa90ffa61ffc87fdf7f9685819d3244 | |
parent | 43378f54af5aeccbb432c5607ce73bf5a82ada21 (diff) |
luastuff.w and luajitstuff.w: Sync with the upstream.
git-svn-id: svn://tug.org/texlive/trunk@36719 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/luajitstuff.w | 10 | ||||
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/luastuff.w | 11 |
2 files changed, 14 insertions, 7 deletions
diff --git a/Build/source/texk/web2c/luatexdir/lua/luajitstuff.w b/Build/source/texk/web2c/luatexdir/lua/luajitstuff.w index 2c08eddde80..9ecd4d6d528 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luajitstuff.w +++ b/Build/source/texk/web2c/luatexdir/lua/luajitstuff.w @@ -93,7 +93,6 @@ static int my_luapanic(lua_State * L) return 0; } - @ @c void luafunctioncall(int slot) { @@ -104,10 +103,12 @@ void luafunctioncall(int slot) lua_gettable(Luas, LUA_REGISTRYINDEX); lua_rawgeti(Luas, -1,slot); if (lua_isfunction(Luas,-1)) { - lua_pushcfunction(Luas, lua_traceback); /* push traceback function */ - lua_insert(Luas, -2); /* put it under chunk */ + int base = lua_gettop(Luas); /* function index */ lua_pushnumber(Luas, slot); - i = lua_pcall(Luas, 1, 0, -2); + lua_pushcfunction(Luas, lua_traceback); /* push traceback function */ + lua_insert(Luas, base); /* put it under chunk */ + i = lua_pcall(Luas, 1, 0, base); + lua_remove(Luas, base); /* remove traceback function */ if (i != 0) { lua_gc(Luas, LUA_GCCOLLECT, 0); Luas = luatex_error(Luas, (i == LUA_ERRRUN ? 0 : 1)); @@ -119,6 +120,7 @@ void luafunctioncall(int slot) + @ @c static const luaL_Reg lualibs[] = { {"", luaopen_base}, diff --git a/Build/source/texk/web2c/luatexdir/lua/luastuff.w b/Build/source/texk/web2c/luatexdir/lua/luastuff.w index 57aa2bb986d..d247bb882b0 100644 --- a/Build/source/texk/web2c/luatexdir/lua/luastuff.w +++ b/Build/source/texk/web2c/luatexdir/lua/luastuff.w @@ -101,10 +101,12 @@ void luafunctioncall(int slot) lua_gettable(Luas, LUA_REGISTRYINDEX); lua_rawgeti(Luas, -1,slot); if (lua_isfunction(Luas,-1)) { - lua_pushcfunction(Luas, lua_traceback); /* push traceback function */ - lua_insert(Luas, -2); /* put it under chunk */ + int base = lua_gettop(Luas); /* function index */ lua_pushnumber(Luas, slot); - i = lua_pcall(Luas, 1, 0, -2); + lua_pushcfunction(Luas, lua_traceback); /* push traceback function */ + lua_insert(Luas, base); /* put it under chunk */ + i = lua_pcall(Luas, 1, 0, base); + lua_remove(Luas, base); /* remove traceback function */ if (i != 0) { lua_gc(Luas, LUA_GCCOLLECT, 0); Luas = luatex_error(Luas, (i == LUA_ERRRUN ? 0 : 1)); @@ -115,6 +117,9 @@ void luafunctioncall(int slot) } + + + @ @c static const luaL_Reg lualibs[] = { {"", luaopen_base}, |