function loadDKJSON(sID) local env = setmetatable({}, {__index=function(o, k) return _G[k] end }) return assert(loadSnippet(sID, env))() end json = loadDKJSON('#44') allSnippets = json.decode(getSnippet('#76')) env = setmetatable({}, {__index=function(o, k) return _G[k] end }) env.snippets = allSnippets -- input is passed on automatically engine = loadSnippet('#45', env) -- the search engine result = engine() print(tostring(#result)..' result(s)') for _, s in ipairs(result) do print('#'..tostring(s.id)..' '..s.name) end return json.encode(result)