I was curious, in lua learning (roblox.com/games/1334669864) they've added the functionality of copying and pasting. I've searched here, and the dev forum. But I can't find out how it's done. Anyone know?
✓ ANSWER ACCEPTED
Copy/paste with gui objects?
1 answer
✓ Accepted answer
Here's some pseudo code of it. Should help you understand the logic:
when the player presses a key, do the following:
If the player presses control, then see what the next button they're going to press is.
If they pressed "C", then
if there is text highlighted then
put all the text into a variable named 'clipboard'
tell the player that their text has been copied onto the clipboard / highlight text
end
--do nothing if there's not any text highlighted
end
--player wants to paste...
else if the player pressed "V" then
if there is something in our clipboard then
if all the text is selected then
make the textbox text the clipboard's text
else if they text isn't selected then
add the clipboard text to what's currently in the textbox
end
end
end
else if the player presses "X" then
if the player has text selected, then
add the text to the clipboard variable
make the text in the textbox empty (" ")
end
end
end
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
