# locate.lua require 'pl' if not command_help then print "must load this using luash" return end command_help.locate = 'search file index for pattern' function commands.locate (args,flags) local f = io.popen('grep '..args[1]..' c:\\contents.txt','r') local d = {fieldnames = 'file'} local maxn = variables.locate_max or 500 local i = 1 for line in f:lines() do if i > maxn then print('first '..maxn..' items found') break end d[i] = {line} i = i + 1 end return d end