Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
tutorial:oc2_writing_code [2015/01/14 23:41]
127.0.0.1 external edit
tutorial:oc2_writing_code [2018/01/15 20:16] (current)
paparadva Updated screenshots
Line 5: Line 5:
 Well, let's start with the good old, proven, beloved first program. You know which one. First off, let's switch to the `/tmp` folder, which is a small, writable file system each computer comes with. Remember, this gets *wiped on reboot*, so don't put anything valuable in here! Well, let's start with the good old, proven, beloved first program. You know which one. First off, let's switch to the `/tmp` folder, which is a small, writable file system each computer comes with. Remember, this gets *wiped on reboot*, so don't put anything valuable in here!
  
-{{http://​i.imgur.com/​Mn8vmbv.png?700}}+{{https://​i.imgur.com/​7YdcUbE.png?700}}
  
 As shown in the image, type `edit <​filename>​`,​ where `filename` is the name of the file you wish to edit. The `.lua` extension is absolutely optional, I just like to keep it for syntax highlighting when opening the files in an external editor. As shown in the image, type `edit <​filename>​`,​ where `filename` is the name of the file you wish to edit. The `.lua` extension is absolutely optional, I just like to keep it for syntax highlighting when opening the files in an external editor.
Line 11: Line 11:
 Once in the editor, start coding. In our case it's just the boring, uncreative-but-proven `print("​Hello World!"​)`. Once in the editor, start coding. In our case it's just the boring, uncreative-but-proven `print("​Hello World!"​)`.
  
-{{http://​i.imgur.com/​geM4Qiz.png?700}}+{{https://​i.imgur.com/​5F16EEV.png?700}}
  
 When you're done, press Ctrl+S to save, then press Ctrl+W to close the editor. If you list the contents of the `/tmp` folder now, you'll see the file has been created. Type its name and press enter to run it: When you're done, press Ctrl+S to save, then press Ctrl+W to close the editor. If you list the contents of the `/tmp` folder now, you'll see the file has been created. Type its name and press enter to run it:
  
-{{http://​i.imgur.com/​CkPSaFK.png?700}}+{{https://​i.imgur.com/​KiHVUMu.png?700}}
  
 Notice that I didn't type the `.lua` extension when running it. The shell will look for files with that extension if it can't find the file with the exact name you specified. Notice that I didn't type the `.lua` extension when running it. The shell will look for files with that extension if it can't find the file with the exact name you specified.