.
This commit is contained in:
parent
911db9a237
commit
c37fc6ddf2
@ -37,50 +37,6 @@ local lines = lines_from(file)
|
||||
--end
|
||||
|
||||
|
||||
|
||||
for k,v in pairs(lines) do
|
||||
sleep(1)
|
||||
if string.match(v, "rect") then
|
||||
if string.match(v, "green") then
|
||||
--print(k .. ": yay")
|
||||
-- lines containing "green"
|
||||
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 .. " 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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--local shapeFile = basic.readFileAll("/brulijam/shape0.svg")
|
||||
|
||||
--print(shapeFile)
|
||||
|
||||
matrix = {}
|
||||
for i = 1, length do
|
||||
matrix[i] = {}
|
||||
@ -89,3 +45,34 @@ for i = 1, length do
|
||||
matrix[i][j] = 0
|
||||
end
|
||||
end
|
||||
|
||||
for k,v in pairs(lines) do
|
||||
sleep(1)
|
||||
print(k)
|
||||
if string.match(v, "green") then
|
||||
--print(k .. ": yay")
|
||||
-- lines containing "green"
|
||||
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)
|
||||
matrix[x][y] = 1
|
||||
end
|
||||
end
|
||||
|
||||
print(matrix)
|
||||
|
||||
|
||||
|
||||
--local shapeFile = basic.readFileAll("/brulijam/shape0.svg")
|
||||
|
||||
--print(shapeFile)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user