On Sat, Mar 07, 2020 at 04:55:06PM +0100, Hans Hagen wrote: > > The problem can be fixed by always looking at stack slot -2 for the > > returned node: > actually we can as well accept nil then so that one can discard something
Returning `nil` is already supported: It is documented and also works fine because `result` is always initialized to `null` (in packaging.c). But I agree that handling that case explicitly in `lua_appendtovlist_callback` might be a bit cleaner and also in some cases slightly more efficient. > > if (lua_type(Luas, -2) == LUA_TUSERDATA) { > halfword* p = lmt_check_isnode(Luas, -2); > *result = *p; > } else if (lua_type(Luas, -2) == LUA_TNIL) { > *result = null; > } else { > normal_warning("append to vlist","error: node or nil expected"); > } > if (lua_type(Luas, -1) == LUA_TNUMBER) { > *next_depth = lmt_roundnumber(Luas, -1); > *prev_set = 1; > } I assume lmt_... is the luametatex equivalent? Marcel _______________________________________________ dev-luatex mailing list dev-luatex@ntg.nl https://mailman.ntg.nl/mailman/listinfo/dev-luatex