summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthe lemons <citrons@mondecitronne.com>2022-12-27 14:12:10 -0600
committerthe lemons <citrons@mondecitronne.com>2022-12-27 14:12:10 -0600
commit80b544614ec3a96e9119a4f8b8f6b34ae07dbfbe (patch)
treee258b54b2e318fa92f372d2c47f2867a1555c414
parentdefa88d271ae7375ec2773f839881474c3bd50ed (diff)
add pasting to the designer
-rw-r--r--designer/main.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/designer/main.lua b/designer/main.lua
index 0b8ad5d..f3b5e8f 100644
--- a/designer/main.lua
+++ b/designer/main.lua
@@ -88,6 +88,14 @@ function love.wheelmoved(_, y)
end
end
+function to_commands(lines)
+ local t = {}
+ for _, l in ipairs(lines) do
+ table.insert(t, "\tline("..table.concat(l, ", ")..")\n")
+ end
+ return table.concat(t)
+end
+
function to_array(lines)
local t = {}
for _, l in ipairs(lines) do
@@ -104,6 +112,12 @@ function love.keypressed(key)
else
love.system.setClipboardText(to_array(lines))
end
+ elseif key == "v" then
+ local c, err = loadstring("return "..love.system.getClipboardText())
+ if c then
+ local ok, ls = pcall(c)
+ if ok then lines = ls end
+ end
end
end
end