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 "luarects.lua"
> bigstr = [[
>> 1/ a \
>>  |b c|
>>  | d |
>>  \  e/
>> ]]
> lwr = LuaWithRects.new(bigstr)
> = lwr
1/ a \
 |b c|
 | d |
 \  e/
> = lwr:read            (2,    3, 6)
b c
> = lwr:readasciirect(9, 2, 4, 3, 6)
w=9 x0=0
b c
 d 
  e
> = lwr:readasciirect(9, 1, 4, 3, 6)
w=9 x0=0
 a 
b c
 d 
  e
> = lwr:replace         (2,    3, 6, "!", ".")
1/ a \
 |!..|
 | d |
 \  e/
> = lwr:replacerect     (1, 4, 3, 6, "!", ".")
1/!..\
 |...|
 |...|
 \.../
> 
> lwr = LuaWithRects.new(bigstr)
> = lwr:matchasciirect(1)
1	1	4	1	7
> = lwr:readasciirect(9, 1, 4, 3, 6)
w=9 x0=0
 a 
b c
 d 
  e
> w, y1, y2, pos1, pos2 = lwr:matchasciirect(1)
> ar = lwr:extractasciirect(w, y1, y2, pos1, pos2, "foo")
> = ar
w=1 x0=0
 a 
b c
 d 
  e
> = lwr
foo   
      
      
      
> 
>