546 posts
Location
Wageningen, The Netherlands
Posted 16 April 2015 - 07:49 PM
It would be nice to have a proper "paste" event which doesn't restrict itself to 256 characters and a single line.
I would also like two new functions:
os.copy(str) – Copies string str to clipboard.
os.clipboard() – Returns a string of what's in the clipboard. If there's nothing in the clipboard, it returns nil.
The clipboard should be the clipboard of the last player to access the computer.
I hope it can be implemented, and there may be a slight problem with system-specific newline characters like "\n" or "\r\n".
Either way, please implement it so that newline characters are just "\n" from lua.
Edited on 17 April 2015 - 07:12 PM
656 posts
Posted 16 April 2015 - 07:54 PM
I think the max copy-paste size is there to keep people from copying their code to a server, breaking the "forth wall" and stuff.
I like the functions you suggested.
Edited on 16 April 2015 - 05:55 PM
2679 posts
Location
You will never find me, muhahahahahaha
Posted 16 April 2015 - 07:56 PM
Totally support the idea. For example in
OmniOS I would like to copy the content of the clipboard into OmniOS's clipboard. However I see no way to do this.
8543 posts
Posted 16 April 2015 - 10:29 PM
Paste size limitations may be due in part to the necessity of transporting the contents of the clipboard from the client to the server.
2679 posts
Location
You will never find me, muhahahahahaha
Posted 16 April 2015 - 10:32 PM
A limit of 10 kB would be fine, but not 256Bytes. what we are also asking for is a way to get the system clipboard w/o pressing ctrl+v
21 posts
Posted 16 April 2015 - 11:15 PM
I wouldnt prefer to use "kb" as size-limit for clipboard…
use string length? Like 1024 or something like that :D/>
7083 posts
Location
Tasmania (AU)
Posted 16 April 2015 - 11:47 PM
os.copy(str) – Copies string str to clipboard.
os.clipboard() – Returns a string of what's in the clipboard. If there's nothing in the clipboard, it returns nil.
Which "clipboard" are we talking about here?
If you mean that of the CC computer itself, as "os.
whatever" would imply, then why not just do?:
local myClipBoard = str
If you mean that of "the real OS of the player", then that raises the questions as to
which player you're going to try and pull data from, and once your script's managed to work that out, whether or not they
want to have their clipboard contents read by you…
656 posts
Posted 16 April 2015 - 11:54 PM
that raises the questions as to which player you're going to try and pull data from
Ah I always seem to forget this argument… Nice catch.
7508 posts
Location
Australia
Posted 17 April 2015 - 04:21 AM
Just incase no one picked up on the subtlety that Bomb Bloke was trying to point out… all computers run on a server, even in Single-player there is a server and client, therefore if you were to have os.copy and os.clipboard they'd be based on the server's clipboard and not the client.
So as Bomb Bloke said, lets assume that it is implemented in a way where the client's clipboard is synchronised through the network, then the question becomes, if 4 people are looking at the computer which client's clipboard do you interact with…
2679 posts
Location
You will never find me, muhahahahahaha
Posted 17 April 2015 - 10:08 AM
So when you press ctrl + v you mean the=at the severs clipboard is invoked. What I meant was that instaed of pressing ctrl + v there is a function to get the clipboard. Like crtl + v, but without pressing them.
656 posts
Posted 17 April 2015 - 10:47 AM
So when you press ctrl + v you mean the=at the severs clipboard is invoked. What I meant was that instaed of pressing ctrl + v there is a function to get the clipboard. Like crtl + v, but without pressing them.
No, he means that when you invoke the methods, there's no way to decide who's clipboard should be used, as multiple players could be using a computer at once.
Edited on 17 April 2015 - 08:49 AM
2679 posts
Location
You will never find me, muhahahahahaha
Posted 17 April 2015 - 07:52 PM
When you press ctrl + v in cc, your clipboard is pulled. What I am saying is that there could be a function like os.getClipboard() that will act as if you pressed ctrl + v.
8543 posts
Posted 17 April 2015 - 08:02 PM
You who, though? You seem to be ignoring the fact that multiple players can use a computer at once. Whose clipboard should be used when that function is called?
2679 posts
Location
You will never find me, muhahahahahaha
Posted 17 April 2015 - 08:17 PM
I have not thought about that. Maybe make it take the clipboard of the person that booted the PC. This destroy all my dreams.
2427 posts
Location
UK
Posted 17 April 2015 - 08:19 PM
what if they go offline on the server? (while the computer is still running)
Edited on 17 April 2015 - 06:19 PM
2679 posts
Location
You will never find me, muhahahahahaha
Posted 17 April 2015 - 08:41 PM
How does the current ctrl + v work. Maybe it should be the person who clicked on the pc while no one else was using it. This way if another person comes, it will still be the first person. If they disconnect, it returns ""
546 posts
Location
Wageningen, The Netherlands
Posted 17 April 2015 - 09:10 PM
You who, though? You seem to be ignoring the fact that multiple players can use a computer at once. Whose clipboard should be used when that function is called?
Sorry Lyqyd, I didn't think of that.
I think the last player to access the computer should be the one with the clipboard.
656 posts
Posted 17 April 2015 - 10:54 PM
You who, though? You seem to be ignoring the fact that multiple players can use a computer at once. Whose clipboard should be used when that function is called?
Sorry Lyqyd, I didn't think of that.
I think the last player to access the computer should be the one with the clipboard.
That's not really intuitive thought. Let's say you're using a computer and someone else opens it, then your clipboard suddently stops working.
And what if the new person leaves? Revert back to your keyboard? And what if no one is using the computer? Return an empty clipboard?
I think it's too complicated to add.
2679 posts
Location
You will never find me, muhahahahahaha
Posted 17 April 2015 - 11:12 PM
It is kind of complicated. And I see no evident solution
7508 posts
Location
Australia
Posted 18 April 2015 - 03:02 AM
How does the current ctrl + v work.
The ctrl + v works currently by when you press ctrl + v your client will send the contents of your clipboard to the server so the paste event can be queued to the computer. This same approach cannot be applied to a function to get the clipboard because that function would run on the server, not your client.
797 posts
Posted 18 April 2015 - 11:56 AM
The only way I could see this working is using the event system, something like this:
-> Client presses ctrl-c
-> "copy" event passed to computer
-> computer yields with clipboard data, i.e. coroutine.yield( "ThisIsStuffToGoInClientClipboard" )
This would almost definitely mess things up if the client didn't yield with the clipboard data after getting the "copy" event, so I doubt it's a feasible solution, although maybe a config option would be good.
656 posts
Posted 18 April 2015 - 03:42 PM
That won't work at all, the string you pass to yield is the event filter, you can't use it for other stuff.
Maybe the event could gcontain the playername, and maybe the clipboard functions could have the player name as a parameter, but tthat's all a bit complicated and it would break the 4th wall.
Edit: typo
Edited on 18 April 2015 - 01:42 PM
2679 posts
Location
You will never find me, muhahahahahaha
Posted 18 April 2015 - 06:28 PM
About the playername, I can actually change my name and if I biuld a program, I would like it to work on everybody.
656 posts
Posted 18 April 2015 - 07:14 PM
About the playername, I can actually change my name and if I biuld a program, I would like it to work on everybody.
Euh, yea? That would work…
event, player = os.pullEvent ("paste")
print (os.getClipboard (player)
2679 posts
Location
You will never find me, muhahahahahaha
Posted 18 April 2015 - 07:35 PM
It would require someone to fire a paste event, but the idea is that it becomes automatical.
656 posts
Posted 18 April 2015 - 09:36 PM
It would require someone to fire a paste event, but the idea is that it becomes automatical.
Of course, I was showing an example of how the problem you mentioned in your previous post could be solved.
2679 posts
Location
You will never find me, muhahahahahaha
Posted 18 April 2015 - 10:04 PM
How is your paste event fired?
3057 posts
Location
United States of America
Posted 18 April 2015 - 10:17 PM
The paste event is handled Java side.