Hi André, My mistake: I tested the code I gave you in \startluacode, but then for the e-mail I wrapped it in \cldcontext. This is not the same: in \startluacode # has its literal value, but in \cldcontext it is interpreted as part of a macro parameter like #1. So to get the length of a table t inside \cldcontext, I should have used the idiom table.getn(t) instead of #t. These two versions both work, and I actually tested them this time: \startluacode context(environment.runpath .. '/' .. file.pathpart(resolvers.inputstack[#resolvers.inputstack]) ) \stopluacode \cldcontext{ environment.runpath .. '/' .. file.pathpart(resolvers.inputstack[table.getn(resolvers.inputstack)]) } Sorry about that mistake. Cheers, Sietse