diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f889f30 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,5 @@ +root = true + +[*.lua] +indent_style = space +indent_size = 1 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 03fadf9..1616417 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.cpio *.af +apidoc.md /target /doc diff --git a/service/clipboard.lua b/service/clipboard.lua index 6ccc07f..99c8c04 100644 --- a/service/clipboard.lua +++ b/service/clipboard.lua @@ -1,11 +1,17 @@ -local lc = computer.uptime() _G.clip = "" -while true do - local eT = {coroutine.yield()} - if eT[1] == "clipboard" then - if computer.uptime() > lc + 5 then - _G.clip = "" - end - _G.clip = _G.clip .. eT[3] - end + +function start() + return os.spawn(function() + local lc + while true do + local eT = {coroutine.yield()} + if eT[1] == "clipboard" then + if computer.uptime() > lc + 5 then + _G.clip = "" + end + lc = computer.uptime() + _G.clip = _G.clip .. eT[3] + end + end + end) end