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