Also found a couple of bugs in the process.
LBQAAJN4CGSIEO3L4UNKYTPX6MRLUJYHCMRMFTFLLTTAGCRUSE7QC
if shape.mode == 'line' then
if shape.mode == 'freehand' then
outfile:write(json.encode({mode='freehand', points={{x=40,y=47}}})..'\n')
for k,v in pairs(shape) do
print(k, v)
end
for k,v in pairs(shape.points) do
print(k,v)
if type(v) == 'table' then
for k,v in pairs(v) do
print('', k,v)
end
end
end
outfile:write(json.encode(shape)..'\n')
elseif shape.mode == 'line' then