Almost done drawing lines

This commit is contained in:
Alexey 2025-05-20 17:03:47 +03:00
commit abce928481
4 changed files with 159 additions and 7 deletions

View file

@ -9,7 +9,10 @@ Config = {
-- love2d line drawing settings
lineStyle = "smooth",
lineWidth = 5
lineWidth = 5,
-- drag sensivity, px
dragSensivity = 5
}
-- Colors table
@ -19,3 +22,23 @@ Color = {
green = { 0, 1, 0 },
blue = { 0, 0, 1 }
}
-- Find key by value in table by predicate
function tableFind( table, value, pred )
for key, innervalue in pairs( table ) do
if pred( value, innervalue ) then
return key
end
end
return nil
end
-- Find if value exists in table by predicate
function tableHas( table, value, pred )
for key, innervalue in pairs( table ) do
if pred( value, innervalue ) then
return true
end
end
return false
end