![](https://secure.gravatar.com/avatar/23bee1ba3b63d309033933539d297fee.jpg?s=120&d=mm&r=g)
Hi, while looking into a [luaotfload bug][bug] caused by the fontloader being confused when LuaTeX overwrites the `parameters` in a cached font table, I wondered why `write_lua_parameters` always creates a new table instead of altering a potentially preexisting table. Changing this should lead to some small performance improvement because Lua no longer has to create a new table every time a cached font table is queried and more importantly it allows additional string keys in `parameters` to be preserved. Best regards Marcel [bug]: https://github.com/u-fischer/luaotfload/issues/3 A patch implementing the suggested change: --- source/texk/web2c/luatexdir/font/luafont.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/texk/web2c/luatexdir/font/luafont.c b/source/texk/web2c/luatexdir/font/luafont.c index e64aaffc1..68e74ffc5 100644 --- a/source/texk/web2c/luatexdir/font/luafont.c +++ b/source/texk/web2c/luatexdir/font/luafont.c @@ -349,7 +349,11 @@ static void write_lua_parameters(lua_State * L, int f) { int k; lua_push_string_by_name(L,parameters); - lua_newtable(L); + lua_pushvalue(L, -1); + if (LUA_TNIL == lua_rawget(L, -3)) { + lua_pop(L, 1); + lua_newtable(L); + } for (k = 1; k <= font_params(f); k++) { switch (k) { case slant_code: -- 2.19.0