summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luajitstuff.w10
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luastuff.w11
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},