Right, indeed nested queries are not going to work. This is what I was able to come up with:
```space-lua
function orphanPages()
-- Collect all page names of non meta-pages and put them in a map
local orphans = {}
for name in query[[
from tags.page
where not table.find(_.tags,
function(t) return t:startsWith("meta") end)
select _.name
]] do
orphans[name] = true
end
-- Then delete all the ones that have links to them
for linked in query[[from tags.link select _.toPage]] do
orphans[linked] = nil
end
return table.keys(orphans)
end
```
${orphanPages()}
Caveat here is that I found a subtle bug that I fixed in 2.1.8 which I just released, so please upgrade to that before trying this.