.
This commit is contained in:
parent
fc646a0f0e
commit
911db9a237
@ -40,34 +40,36 @@ local lines = lines_from(file)
|
|||||||
|
|
||||||
for k,v in pairs(lines) do
|
for k,v in pairs(lines) do
|
||||||
sleep(1)
|
sleep(1)
|
||||||
if string.match(v, "green") then
|
if string.match(v, "rect") then
|
||||||
--print(k .. ": yay")
|
if string.match(v, "green") then
|
||||||
-- lines containing "green"
|
--print(k .. ": yay")
|
||||||
xStart = string.find(v, "x=\"")
|
-- lines containing "green"
|
||||||
xEnd = string.find(v, "\" y=")
|
xStart = string.find(v, "x=\"")
|
||||||
yStart = string.find(v, "y=\"")
|
xEnd = string.find(v, "\" y=")
|
||||||
yEnd = string.find(v, "\" st")
|
yStart = string.find(v, "y=\"")
|
||||||
|
yEnd = string.find(v, "\" st")
|
||||||
|
|
||||||
xStr = string.sub(v, xStart+3, xEnd-1)
|
xStr = string.sub(v, xStart+3, xEnd-1)
|
||||||
yStr = string.sub(v, yStart+3, yEnd-1)
|
yStr = string.sub(v, yStart+3, yEnd-1)
|
||||||
|
|
||||||
x = tonumber(xStr) / steps
|
x = tonumber(xStr) / steps
|
||||||
y = tonumber(yStr) / steps
|
y = tonumber(yStr) / steps
|
||||||
|
|
||||||
print(x .. " " .. y .. " g")
|
print(x .. " " .. y .. " g")
|
||||||
else
|
else
|
||||||
xStart = string.find(v, "x=\"")
|
xStart = string.find(v, "x=\"")
|
||||||
xEnd = string.find(v, "\" y=")
|
xEnd = string.find(v, "\" y=")
|
||||||
yStart = string.find(v, "y=\"")
|
yStart = string.find(v, "y=\"")
|
||||||
yEnd = string.find(v, "\" st")
|
yEnd = string.find(v, "\" st")
|
||||||
|
|
||||||
xStr = string.sub(v, xStart+3, xEnd-1)
|
xStr = string.sub(v, xStart+3, xEnd-1)
|
||||||
yStr = string.sub(v, yStart+3, yEnd-1)
|
yStr = string.sub(v, yStart+3, yEnd-1)
|
||||||
|
|
||||||
x = tonumber(xStr) / steps
|
x = tonumber(xStr) / steps
|
||||||
y = tonumber(yStr) / steps
|
y = tonumber(yStr) / steps
|
||||||
|
|
||||||
print(x .. " " .. y .. " x")
|
print(x .. " " .. y .. " x")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user