This commit is contained in:
Julian Brammer 2024-06-12 22:00:48 +02:00
parent 8ed0a2bf39
commit b519308f7e

View File

@ -39,8 +39,9 @@ local lines = lines_from(file)
for k,v in pairs(lines) do for k,v in pairs(lines) do
sleep(1)
if string.match(v, "green") then if string.match(v, "green") then
print(k .. ": yay") --print(k .. ": yay")
-- lines containing "green" -- lines containing "green"
xStart = string.find(v, "x=\"") xStart = string.find(v, "x=\"")
xEnd = string.find(v, "\" y=") xEnd = string.find(v, "\" y=")
@ -53,12 +54,27 @@ for k,v in pairs(lines) do
x = tonumber(xStr) / steps x = tonumber(xStr) / steps
y = tonumber(yStr) / steps y = tonumber(yStr) / steps
print(x .. " " .. y) print(x .. " " .. y .. " g")
else
xStart = string.find(v, "x=\"")
xEnd = string.find(v, "\" y=")
yStart = string.find(v, "y=\"")
yEnd = string.find(v, "\" st")
xStr = string.sub(v, xStart+3, xEnd-1)
yStr = string.sub(v, yStart+3, yEnd-1)
x = tonumber(xStr) / steps
y = tonumber(yStr) / steps
print(x .. " " .. y . " x")
end end
end end
--local shapeFile = basic.readFileAll("/brulijam/shape0.svg") --local shapeFile = basic.readFileAll("/brulijam/shape0.svg")
--print(shapeFile) --print(shapeFile)