Wiki

Clone wiki

Core / CopyingCode

Copying code to and from Codea

At the moment, there is not an elegant answer to copying code to and from Codea. For now, you can:

  1. copy and paste them (see below), or
  2. use an independent tool to download and upload projects into Codea (see Codea under the hood).

Copying code from Codea

Text can be selected and copied to the clipboard in Codea's Editor. Once copied, it can (for example) be pasted into another project opened in the Editor, a comment on the forum, an edited page on the wiki or an email using the Mail app.

The entire text of a project can also be copied to the clipboard. To do this, touch and hold the icon for the project on Codea's home screen. Select the 'Copy' option that then appears. The content of all of the tabs in the project will be concatenated in the copy, with the contents of each tab in the copy introduced by a comment, such as --# Main.

The concatenated text can be pasted into a single tab of a new project opened in the Editor, where it will run.

The code in a Codea tab can also be obtained as a string value in code, by making use of the debug.getinfo() function.

Copying code to Codea

Text copied to the clipboard can be pasted into a project opened in Codea's Editor.

IMPORTANT - if the code you are copying and pasting has multiple tabs, and you paste it into a Codea tab, you will just get all the code in that one tab. To get the code to split into its separate tabs, you need to go to the main Codea screen, and press on the Add New Project button until you get the option to paste into a new project.

It may prove difficult to copy text from web pages in the Safari (or other browser) app. Other Codea users have used independent iPad apps such as Good.iWare Ltd.'s GoodReader for iPad, Bao Lei's Fast Keyboard or De Voorkant's iUnarchive (or competing apps). These apps allow text files to be downloaded from the web and edited, so that text can then be copied on to the iPad's clipboard.

Some Codea users publish their code on GitHub. GitHub allows code to be downloaded as a zip or tarball file. In those cases, an app such as De Voorkant's iUnarchive (or competing apps) can be useful to unpack the archive.

Updated