Warning: this is an htmlized version! The original is across this link, and the conversion rules are here.
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> dofile "newrect.lua"
> z = ZHA.fromspec("121L"):print()
21
11
10  01
00
> mp = MixedPicture.new({bhbox=1, paren=1, scale="20pt", def="foo"}, z)
> mp = MixedPicture.new({bhbox=1, scale="14pt", cellfont="\\scriptsize", def="foo"}, z)
> -- for v in z:points() do mp:put(v, v:lr()) end
> for v in z:points() do mp:put(v, v:xy()) end
> = mp
(-
(0
(-  (1
(0
> for v,dx,dy in mp.zha:arrows() do print(v, dx, dy) end
(-1,3)	1	-1
(0,2)	-1	-1
(0,2)	1	-1
(-1,1)	1	-1
(1,1)	-1	-1
> for v,dx,dy in mp.zha:arrows() do
>>   local tex = (dx==-1) and "\\swarrow" or "\\searrow"
>>   mp.lp:putarrow(v, dx, dy, tex)
>> end
> = mp.lp
\def\foo{\bhbox{$\vcenter{\hbox{\unitlength=14pt% \celllower=2.5pt% \def\cellfont{\scriptsize}% \begin{picture}(3,4)(-1.5,-0.5) \put(-1,3){\cell{(-1,3)}} \put(-1,1){\cell{(-1,1)}} \put(0,2){\cell{(0,2)}} \put(0,0){\cell{(0,0)}} \put(1,1){\cell{(1,1)}} \put(-0.5,2.5){\cell{\searrow}} \put(-0.5,1.5){\cell{\swarrow}} \put(0.5,1.5){\cell{\searrow}} \put(-0.5,0.5){\cell{\searrow}} \put(0.5,0.5){\cell{\swarrow}} \end{picture}}}$}}
> latex = mp:tolatex()
> latex = "\\def\\foo{"..latex.."}"
> = latex
\def\foo{\def\foo{\bhbox{$\vcenter{\hbox{\unitlength=14pt% \celllower=2.5pt% \def\cellfont{\scriptsize}% \begin{picture}(3,4)(-1.5,-0.5) \put(-1,3){\cell{(-1,3)}} \put(-1,1){\cell{(-1,1)}} \put(0,2){\cell{(0,2)}} \put(0,0){\cell{(0,0)}} \put(1,1){\cell{(1,1)}} \put(-0.5,2.5){\cell{\searrow}} \put(-0.5,1.5){\cell{\swarrow}} \put(0.5,1.5){\cell{\searrow}} \put(-0.5,0.5){\cell{\searrow}} \put(0.5,0.5){\cell{\swarrow}} \end{picture}}}$}}}
> writefile("/tmp/o.tex", latex)  -- (find-fline "/tmp/o.tex")
>
>