From 80b544614ec3a96e9119a4f8b8f6b34ae07dbfbe Mon Sep 17 00:00:00 2001 From: the lemons Date: Tue, 27 Dec 2022 14:12:10 -0600 Subject: add pasting to the designer --- designer/main.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'designer/main.lua') 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 -- cgit v1.2.3