<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://www.computercraft.info/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=PTS</id>
		<title>ComputerCraft Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://www.computercraft.info/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=PTS"/>
		<link rel="alternate" type="text/html" href="https://www.computercraft.info/wiki/Special:Contributions/PTS"/>
		<updated>2026-07-11T12:59:44Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.24.1</generator>

	<entry>
		<id>https://www.computercraft.info/wiki/index.php?title=Making_an_API_(tutorial)&amp;diff=1149</id>
		<title>Making an API (tutorial)</title>
		<link rel="alternate" type="text/html" href="https://www.computercraft.info/wiki/index.php?title=Making_an_API_(tutorial)&amp;diff=1149"/>
				<updated>2012-03-20T18:53:14Z</updated>
		
		<summary type="html">&lt;p&gt;PTS: Method for auto loading&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== MAKING AN API - a tutorial by TheVarmari ==&lt;br /&gt;
'''NOTE:''' There is a better tutorial in the [http://www.computercraft.info/forums2/ forums] located [http://www.computercraft.info/forums2/index.php?/topic/145-tutorial-creating-an-api/ here].&lt;br /&gt;
Use this if you prefer to use ccwiki.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
Hello, dear Computercraft Wiki user!&lt;br /&gt;
Today I will tell you how to make a functional API (Application Programming Interface).&lt;br /&gt;
Let's get started!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Making the API file ==&lt;br /&gt;
First we need to define what our API will be called.&lt;br /&gt;
In this case, I use exampleAPI.&lt;br /&gt;
Now edit the file you want your API to be called.&lt;br /&gt;
&amp;lt;!--NOTE: If it exists, call it something else--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
Now, we need to put some functions in it!&lt;br /&gt;
Why don't we start with the basics:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 -- this is the file exampleAPI&lt;br /&gt;
 -- our first function:&lt;br /&gt;
 function printMessage()&lt;br /&gt;
   print(&amp;quot;message&amp;quot;)&lt;br /&gt;
 end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Which basically prints &amp;quot;message&amp;quot; when excecuted.&lt;br /&gt;
Save the file.&lt;br /&gt;
&lt;br /&gt;
=== Including the API ===&lt;br /&gt;
Now that we have the API done, let's include it in some file!&lt;br /&gt;
Because we speak about APIs, we can't directly execute it.&lt;br /&gt;
&lt;br /&gt;
Edit the file you want to include the API in.&lt;br /&gt;
In my case, it is called exampleFile.&lt;br /&gt;
Now, we include the API in it by typing this to the '''first''' row:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 os.loadAPI(&amp;quot;exampleAPI&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This loads the API into the file's memory.&amp;lt;br /&amp;gt;&lt;br /&gt;
'''NOTE:''' If you want your API to be loaded on every computer, copy your file to ''.minecraft\mods\ComputerCraft\lua\rom\apis\''.&lt;br /&gt;
&lt;br /&gt;
=== Using the API ===&lt;br /&gt;
Now that that's over, let's include the printMessage command from our API.&lt;br /&gt;
Lua loads API's as tables, so you have to use api_name.function_name(function_arguments)&lt;br /&gt;
&lt;br /&gt;
In my case, I use&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 exampleAPI.printMessage()&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Ta-da! It printed out &amp;quot;message&amp;quot;!&lt;br /&gt;
&lt;br /&gt;
== A couple of words ==&lt;br /&gt;
Thank you for reading this tutorial, it sure was fun to make!&lt;br /&gt;
Correct any mistakes I did! &lt;br /&gt;
[[User:TheVarmari|TheVarmari]] 16:59, 22 February 2012 (UTC)&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>PTS</name></author>	</entry>

	<entry>
		<id>https://www.computercraft.info/wiki/index.php?title=Startup&amp;diff=1148</id>
		<title>Startup</title>
		<link rel="alternate" type="text/html" href="https://www.computercraft.info/wiki/index.php?title=Startup&amp;diff=1148"/>
				<updated>2012-03-20T18:43:36Z</updated>
		
		<summary type="html">&lt;p&gt;PTS: Noted boot order. Removed forward slashes from example code paths (lua paths do not begin with a slash)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Startup Scripts==&lt;br /&gt;
If, upon booting, a computer terminal detects a script named &amp;quot;startup&amp;quot; in its root directory, this script will be run. Similarly, if a disk is present in an attached disk drive containing a script named &amp;quot;startup&amp;quot; that script will be run. Disk autorun scripts take prevalence over root directory autorun. This means if both the root directory and the disk contain a file called &amp;quot;startup&amp;quot; the one on the disk will be executed.&lt;br /&gt;
&lt;br /&gt;
===Very simple auto-install script to set up a single-use terminal (e.g. password-protected door):===&lt;br /&gt;
Disk contents:&lt;br /&gt;
 /disk/startup (installer script)&lt;br /&gt;
 /disk/startup.file (program to be installed on terminal)&lt;br /&gt;
&lt;br /&gt;
The script could look like:&lt;br /&gt;
  fs.copy(&amp;quot;disk/startup.file&amp;quot;, &amp;quot;startup&amp;quot;)&lt;br /&gt;
  shell.run(&amp;quot;startup&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
When the disk is placed into a drive attached to a terminal, and the terminal is rebooted - the startup file on the disk will run. This startup file serves only to copy the program you've named &amp;quot;startup.file&amp;quot; to the root directory of the terminal with the new name &amp;quot;startup&amp;quot; - this will then run each time the terminal is booted, eliminating the need for the disk drive.&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>PTS</name></author>	</entry>

	<entry>
		<id>https://www.computercraft.info/wiki/index.php?title=Advanced_Turtle_Lumberjack_(tutorial)&amp;diff=1147</id>
		<title>Advanced Turtle Lumberjack (tutorial)</title>
		<link rel="alternate" type="text/html" href="https://www.computercraft.info/wiki/index.php?title=Advanced_Turtle_Lumberjack_(tutorial)&amp;diff=1147"/>
				<updated>2012-03-20T18:37:52Z</updated>
		
		<summary type="html">&lt;p&gt;PTS: Fixed the loop so it actually works. Added forward movement after the first block is removed.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Advanced Turtle Lumberjack ==&lt;br /&gt;
=== Introduction ===&lt;br /&gt;
Welcome to this [[:Category:Tutorials|tutorial]] about Advanced Turtle Lumberjacks.&lt;br /&gt;
See the [[Turtle_Lumberjack_(tutorial)|Turtle Lumberjack Tutorial]] first.&lt;br /&gt;
&lt;br /&gt;
=== What are Advanced Turtle Lumberjacks? ===&lt;br /&gt;
Advanced Turtle Lumberjacks are basically [[Turtle_Lumberjack_(tutorial)|Turtle Lumberjacks]] that can dig blocks above them. We first make the turtle dig the block in front of it and then move forward so the rest of the tree is directly above it.&lt;br /&gt;
&lt;br /&gt;
== The Code ==&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  turtle.dig()&lt;br /&gt;
  turtle.forward()&lt;br /&gt;
  while turtle.detectUp() do&lt;br /&gt;
    turtle.digUp()&lt;br /&gt;
    turtle.up()&lt;br /&gt;
  end&lt;br /&gt;
  while not turtle.detectDown() do&lt;br /&gt;
    turtle.down()&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This makes us check if there are no blocks to be digged, then we go down until we can't.&lt;br /&gt;
That's it!&lt;br /&gt;
&lt;br /&gt;
('''Helpful tip:''' Save this to your computercraft/lua/rom/programs folder, then it will be on all turtles.)&lt;br /&gt;
&lt;br /&gt;
== Category &amp;amp; Author ==&lt;br /&gt;
A tutorial by [[User:TheVarmari|TheVarmari]]. Feel free to correct any mistakes!&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>PTS</name></author>	</entry>

	<entry>
		<id>https://www.computercraft.info/wiki/index.php?title=Turtle_(API)&amp;diff=1140</id>
		<title>Turtle (API)</title>
		<link rel="alternate" type="text/html" href="https://www.computercraft.info/wiki/index.php?title=Turtle_(API)&amp;diff=1140"/>
				<updated>2012-03-19T15:13:19Z</updated>
		
		<summary type="html">&lt;p&gt;PTS: Added amount variable to turtle.drop&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Turtle API is used to Work with your Turtles.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
!style=&amp;quot;background:#EEE&amp;quot; width=&amp;quot;200px&amp;quot;|Method name&lt;br /&gt;
!style=&amp;quot;background:#EEE&amp;quot; width=&amp;quot;*&amp;quot;|Description&lt;br /&gt;
|-&lt;br /&gt;
|[[turtle.forward]]()&lt;br /&gt;
|Let the Turtle move forward&lt;br /&gt;
|-&lt;br /&gt;
|[[turtle.back]]()&lt;br /&gt;
|Let the Turtle move back&lt;br /&gt;
|-&lt;br /&gt;
|[[turtle.up]]()&lt;br /&gt;
|Let the Turtle move up&lt;br /&gt;
|-&lt;br /&gt;
|[[turtle.down]]()&lt;br /&gt;
|Let the Turtle move down &lt;br /&gt;
|-&lt;br /&gt;
|[[turtle.turnLeft]]()&lt;br /&gt;
|The Turtle turns left&lt;br /&gt;
|-&lt;br /&gt;
|[[turtle.turnRight]]()&lt;br /&gt;
|The Turtle turns right&lt;br /&gt;
|-&lt;br /&gt;
|[[turtle.select]]( slotNum )&lt;br /&gt;
|The Turtle selects the given Slot (1 is top left, 9 is bottom right)&lt;br /&gt;
|-&lt;br /&gt;
|[[turtle.getItemCount]]( slotNum )&lt;br /&gt;
|Counts how many items are in the given Slot&lt;br /&gt;
|-&lt;br /&gt;
|[[turtle.getItemSpace]]( slotNum )&lt;br /&gt;
|Counts how many items you need to fill the stack in the given Slot&lt;br /&gt;
|-&lt;br /&gt;
|[[turtle.dig]]()&lt;br /&gt;
|Breaks the Block in front&lt;br /&gt;
|-&lt;br /&gt;
|[[turtle.digUp]]()&lt;br /&gt;
|Breaks the Block above&lt;br /&gt;
|-&lt;br /&gt;
|[[turtle.digDown]]()&lt;br /&gt;
|Breaks the Block below&lt;br /&gt;
|-&lt;br /&gt;
|[[turtle.place]]()&lt;br /&gt;
|Places a Block of the selected Slot in front&lt;br /&gt;
|-&lt;br /&gt;
|[[turtle.placeUp]]()&lt;br /&gt;
|Places a Block of the selected Slot above&lt;br /&gt;
|-&lt;br /&gt;
|[[turtle.placeDown]]()&lt;br /&gt;
|Places a Block of the selected Slot below&lt;br /&gt;
|-&lt;br /&gt;
|[[turtle.detect]]()&lt;br /&gt;
|Detects if there is a Block in front&lt;br /&gt;
|-&lt;br /&gt;
|[[turtle.detectUp]]()&lt;br /&gt;
|Detects if there is a Block above&lt;br /&gt;
|-&lt;br /&gt;
|[[turtle.detectDown]]()&lt;br /&gt;
|Detects if there is a Block below&lt;br /&gt;
|-&lt;br /&gt;
|[[turtle.compare]]()&lt;br /&gt;
|Detects if the block in front is the same as the one in the selected Slot&lt;br /&gt;
|-&lt;br /&gt;
|[[turtle.compareUp]]()&lt;br /&gt;
|Detects if the block above is the same as the one in the selected Slot&lt;br /&gt;
|-&lt;br /&gt;
|[[turtle.compareDown]]()&lt;br /&gt;
|Detects if the block below is the same as the one in the selected Slot&lt;br /&gt;
|-&lt;br /&gt;
|[[turtle.drop]]( [ammount] )&lt;br /&gt;
|Drops everything of the selected Slot or the specified amount&lt;br /&gt;
|}&lt;br /&gt;
[[Category:APIs]]&lt;/div&gt;</summary>
		<author><name>PTS</name></author>	</entry>

	<entry>
		<id>https://www.computercraft.info/wiki/index.php?title=Peripheral_(API)&amp;diff=1088</id>
		<title>Peripheral (API)</title>
		<link rel="alternate" type="text/html" href="https://www.computercraft.info/wiki/index.php?title=Peripheral_(API)&amp;diff=1088"/>
				<updated>2012-03-17T09:25:32Z</updated>
		
		<summary type="html">&lt;p&gt;PTS: Created article, added short description of all methods. Used some data directly from the mod's documentation.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The peripheral API is for interacting with external peripherals, such as the disk drive and monitor.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
!style=&amp;quot;background:#EEE&amp;quot; width=&amp;quot;210px&amp;quot;|Method name&lt;br /&gt;
!style=&amp;quot;background:#EEE&amp;quot; width=&amp;quot;*&amp;quot;|Description&lt;br /&gt;
|-&lt;br /&gt;
|peripheral.isPresent( side )&lt;br /&gt;
|Returns '''true''' if a peripheral is present on ''side''.&lt;br /&gt;
|-&lt;br /&gt;
|peripheral.getType( side )&lt;br /&gt;
|Returns the type or peripheral present on ''side'', nothing returned if ''side'' is empty.&lt;br /&gt;
|-&lt;br /&gt;
|peripheral.getMethods( side )&lt;br /&gt;
|Returns a table containing all methods for peripheral on ''side''.&lt;br /&gt;
|-&lt;br /&gt;
|peripheral.call( side, methodName, param1, param2, ... )&lt;br /&gt;
|Sends a function call to peripheral located on ''side''. Return values match those of called method.&amp;lt;br /&amp;gt;&lt;br /&gt;
'''Note:''' ''methodName'' is a string.&lt;br /&gt;
|-&lt;br /&gt;
|peripheral.wrap( side )&lt;br /&gt;
|Returns a handle to the peripheral located on ''side''. If assigned to a variable, it can be used to call all methods available, as if calling '''peripheral.call()''', e.g.:&amp;lt;br /&amp;gt;&lt;br /&gt;
fdd = peripheral.wrap(&amp;quot;left&amp;quot;)&amp;lt;br /&amp;gt;&lt;br /&gt;
fdd.isPresent()&amp;lt;br /&amp;gt;&lt;br /&gt;
''- is the same as -''&amp;lt;br /&amp;gt;&lt;br /&gt;
peripheral.call(&amp;quot;left&amp;quot;,&amp;quot;isPresent&amp;quot;)&lt;br /&gt;
|}&lt;br /&gt;
When new peripherals are added and removed from the computer, the events '''peripheral''' and '''peripheral_detach'' will fire, with the side as a parameter. [[Console|Consoles]] and [[Turtle|Turtles]] are also considered peripherals and you can interface two adjacent computers, although in a more limited fashion, compared to with [[Rednet (API)|rednet]]. Both Computers and Turtles provide the same methods: ''turnOn'', ''suthdown'', ''reboot'', ''getID''.&lt;br /&gt;
[[Category:APIs]]&lt;/div&gt;</summary>
		<author><name>PTS</name></author>	</entry>

	<entry>
		<id>https://www.computercraft.info/wiki/index.php?title=Textutils_(API)&amp;diff=1087</id>
		<title>Textutils (API)</title>
		<link rel="alternate" type="text/html" href="https://www.computercraft.info/wiki/index.php?title=Textutils_(API)&amp;diff=1087"/>
				<updated>2012-03-17T08:42:45Z</updated>
		
		<summary type="html">&lt;p&gt;PTS: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Text utilities is used to mess around with text easier.&lt;br /&gt;
&lt;br /&gt;
Its functions include:&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
!style=&amp;quot;background:#EEE&amp;quot; width=&amp;quot;200px&amp;quot;|Method name&lt;br /&gt;
!style=&amp;quot;background:#EEE&amp;quot; width=&amp;quot;*&amp;quot;|Description&lt;br /&gt;
|-&lt;br /&gt;
|textutils.slowPrint( text )&lt;br /&gt;
|Slowly prints the text.&lt;br /&gt;
|-&lt;br /&gt;
|textutils.slowWrite( text )&lt;br /&gt;
|Slowly writes the text.&lt;br /&gt;
|-&lt;br /&gt;
|textutils.formatTime( time, bTwentyFourHour)&lt;br /&gt;
|Put a time into it, and it spews it out in a different format.&lt;br /&gt;
|-&lt;br /&gt;
|textutils.tabulate( table, table2, so on)&lt;br /&gt;
|Prints tables in an ordered form. Each table is a row, columns' width is auto-adjusted.&lt;br /&gt;
|-&lt;br /&gt;
|textutils.pagedTabulate( table, table2, so on)&lt;br /&gt;
|&amp;lt;no description given&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|textutils.serialize( t )&lt;br /&gt;
|&amp;lt;no description given&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|textutils.unserialize( s )&lt;br /&gt;
|&amp;lt;no description given&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|textutils.urlEncode( str )&lt;br /&gt;
|&amp;lt;no description given&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[Category:APIs]]&lt;/div&gt;</summary>
		<author><name>PTS</name></author>	</entry>

	</feed>