Warning: this is an htmlized version!
The original is across this link,
and the conversion rules are here.
-- Make a monochromatic rectangle
-- Edrx, 2004sep09
-- Usage: lua50 rectxpm.lua rrggbb sizeh sizev
-- (find-sh "lua50 ~/LUA/rectxpm.lua '#ff0000' 60 20 > /tmp/rect.xpm")
-- (find-fline "/tmp/rect.xpm")
-- (let ((auto-image-file-mode nil)) (find-fline "/tmp/rect.xpm"))
-- (find-es "x" "xpm")

color, sizeh, sizev = arg[1], arg[2], arg[3]
print ("/* XPM */")
printf("static char * myrect%dx%d[] = {\n", sizeh, sizev)
printf("\"%d %d 1 1\",\n", sizeh, sizev)
printf("\". c %s\",\n", color)
line = "\"" .. string.rep(".", sizeh) .. "\""
for j = 1,sizev do
  if j ~= sizev then
    print(line .. ",")
  else
    print(line .. "};")
  end
end