http://www.computercraft.info/wiki/api.php?action=feedcontributions&user=Onionnion&feedformat=atomComputerCraft Wiki - User contributions [en]2024-03-29T06:41:04ZUser contributionsMediaWiki 1.24.1http://www.computercraft.info/wiki/index.php?title=Talk:Tutorials&diff=1534Talk:Tutorials2012-05-15T19:26:49Z<p>Onionnion: </p>
<hr />
<div>Here is a bunch of tutorials!<br />
<br />
== Cleanup ==<br />
<br />
This tutorials section is badly in need of a cleanup. The only page here ''that is actually a tutorial'' is the "Hello World!" script, and everyone who's ever coded in any language knows that is the most basic script you can create, and always the first script for new languages.<br />
''Every'' other page here is just throwing scripts at the user. The "Password protected door" page screenshots are ignoring ''all'' best practices. I'll be rewriting this section, if you want to help, use the current pages as an example of what ''not'' to do.<br />
Tutorials should be for teaching, not showing off. [[User:My hat stinks|my_hat_stinks]] 11:13, 15 May 2012 (UTC)<br />
<br />
<br />
== Hole digging turtle ==<br />
<br />
=== Hole digging turtle ===<br />
<br />
Here is a quick little code i made, it makes a turtle dig a hole, 4x4 and 4 deep.<br />
<br />
local function Digpart()<br />
turtle.digDown()<br />
turtle.down()<br />
turtle.dig()<br />
turtle.forward()<br />
turtle.dig()<br />
turtle.forward()<br />
turtle.dig()<br />
turtle.forward()<br />
turtle.turnRight()<br />
turtle.dig()<br />
turtle.forward()<br />
turtle.turnRight()<br />
turtle.dig()<br />
turtle.forward()<br />
turtle.dig()<br />
turtle.forward()<br />
turtle.dig()<br />
turtle.forward()<br />
turtle.turnLeft()<br />
turtle.dig()<br />
turtle.forward()<br />
turtle.turnLeft()<br />
turtle.dig()<br />
turtle.forward()<br />
turtle.dig()<br />
turtle.forward()<br />
turtle.dig()<br />
turtle.forward()<br />
turtle.turnRight()<br />
turtle.dig()<br />
turtle.forward()<br />
turtle.turnRight()<br />
turtle.dig()<br />
turtle.forward()<br />
turtle.dig()<br />
turtle.forward()<br />
turtle.dig()<br />
turtle.forward()<br />
turtle.turnRight()<br />
end<br />
<br />
Digpart()<br />
Digpart()<br />
Digpart()<br />
Digpart()<br />
turtle.up()<br />
turtle.up()<br />
turtle.up()<br />
turtle.up()<br />
turtle.turnRight()<br />
turtle.turnRight()<br />
turtle.forward()<br />
<br />
Lets break it down, its quite simple, the first part creates a function, a function can be reused whenever you want, its just a good way of making things more, Tidy, next we have 4 parts that call the function, this makes the turtle dig the hole 4 times, making it 4 deep.<br />
the next part, is very simple, it gets the little turtle out of the hole, so you don't have to climb down there to get your little friend back.<br />
well, that's my little code, hope you enjoy it!<br />
<br />
----<br />
You know, you can use loops to run that function instead of having to type so many lines. --[[User:Onionnion|Onionnion]] 19:26, 15 May 2012 (UTC)</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Talk:Making_a_Delay_function&diff=1530Talk:Making a Delay function2012-05-14T13:19:42Z<p>Onionnion: </p>
<hr />
<div>==Useless Page?==<br />
There's already sleep(seconds), there's no need for this page? <small><span class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[User:24.20.222.206|24.20.222.206]] ([[User talk:24.20.222.206|talk]] • [[Special:Contributions/24.20.222.206|contribs]]) </span></small><!-- Template:Unsigned --><br />
<br />
I agree, there is no need for the use of a function that does a task native to Lua. I mean the sleep(n) command is not even part of the API... I think we should either put this as a general tutorial for understanding functions, or delete the page entirely. [[Special:Contributions/71.224.247.65|71.224.247.65]] 04:30, 14 May 2012 (UTC)<br />
<br />
I'll change it to being about understanding functions. Would make a good guide for how to make functions and what they are, except how to return values. --[[User:Onionnion|Onionnion]] 13:19, 14 May 2012 (UTC)</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Tutorials&diff=1502Tutorials2012-05-08T13:31:42Z<p>Onionnion: Added External Tutorials/Guides</p>
<hr />
<div>Look for the [[Getting Started]] guide if this is your first try. As some tutorials might not be listed here, you can also browse the [[:Category:Tutorials|tutorials category]].<br />
<br />
=== Basics ===<br />
Common things that may need some explanation.<br />
*[[The console and its shell]]<br />
<br />
=== Programming & Wiring ===<br />
*[[Hello_World_Tutorial|Hello World!]]<br />
*[[Making_a_Delay_function|Making a Delay (timer) function]]<br />
*[[Guess_The_Number_(tutorial)|Guess the Number]]<br />
*[[Making_a_Password_Protected_Door|Password Protected Door]]<br />
*[[Making_an_API_(tutorial)|Programming an API]]<br />
*[[Startup|Running script automatically at boot with Startup]]<br />
*[[Raw key events| Detecting specific keys (such as the arrow keys)]]<br />
*[[Receiving a rednet message through os.pullEvent()|Receiving a rednet message through os.pullEvent()]]<br />
*[[Calculator_Tutorial]]<br />
=== Turtles ===<br />
The nice little robots that do the hard work for you.<br />
*[[Turtle_Tutorial|Turtles!]]<br />
*[[Turtle_Lumberjack_(tutorial)|Turtle Lumberjack]]<br />
*[[Advanced_Turtle_Lumberjack_(tutorial)|Advanced Turtle Lumberjack]]<br />
*[[Cobble_Generator|Cobblestone Generator]]<br />
*[[Turtle_Stairbuilder_(tutorial)|Turtle Stairbuilder]]<br />
=== External Tutorials/Guides ===<br />
*[http://www.computercraft.info/forums2/index.php?/topic/33-computercraft-v12-very-basic-lua-tutorial/page__view__findpost__p__122 Onionnion's Basic Lua Tutorial]<br />
*[http://www.computercraft.info/forums2/index.php?/topic/1516-ospullevent-what-is-it-and-how-is-it-useful/page__view__findpost__p__11156 Onionnion's os.pullEvent() Guide]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Redstone.getOutput&diff=1501Redstone.getOutput2012-05-06T17:46:34Z<p>Onionnion: Added lowercase template; should be properly formatted with the function template</p>
<hr />
<div>{{lowercase}}<br />
Redstone.getOutput(side) returns whatever you had set with Redstone.setOutput(side, out). <br />
== Example ==<br />
redstone.setOutput("left", true) -- Set the output on the left to true<br />
<br />
print(redstone.getOutput("left")) -Print the output</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=User_talk:Zalerinian&diff=1499User talk:Zalerinian2012-05-06T14:32:59Z<p>Onionnion: Created page with "Thanks for the contribs! --~~~~"</p>
<hr />
<div>Thanks for the contribs!<br />
--[[User:Onionnion|Onionnion]] 14:32, 6 May 2012 (UTC)</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Talk:Calculator_Tutorial&diff=1485Talk:Calculator Tutorial2012-05-06T02:32:09Z<p>Onionnion: </p>
<hr />
<div>Not exactly the most well-written script.<br />
--[[User:Onionnion|Onionnion]] 02:32, 6 May 2012 (UTC)</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Talk:Calculator_Tutorial&diff=1484Talk:Calculator Tutorial2012-05-06T02:30:31Z<p>Onionnion: </p>
<hr />
<div>Not exactly the most well-written script.<br />
--[[User:Onionnion|Onionnion]] 02:30, 6 May 2012 (UTC)</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Talk:Calculator_Tutorial&diff=1483Talk:Calculator Tutorial2012-05-06T02:29:50Z<p>Onionnion: Created page with "Not exactly the most well-written script. --~~~~"</p>
<hr />
<div>Not exactly the most well-written script.<br />
--[[User:Onionnion|Onionnion]] 02:29, 6 May 2012 (UTC)</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Template:News&diff=1481Template:News2012-05-05T22:54:49Z<p>Onionnion: </p>
<hr />
<div>ComputerCraft is currently at version 1.33 for Minecraft 1.2.5.<br />
<br />
[[Changelog]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Template:News&diff=1480Template:News2012-05-05T22:54:19Z<p>Onionnion: </p>
<hr />
<div>ComputerCraft is currently at version 1.33 for Minecraft 1.2.5.<br />
<br />
----<br />
<br />
[[Changelog]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Template:News&diff=1479Template:News2012-05-05T22:54:00Z<p>Onionnion: </p>
<hr />
<div>ComputerCraft is currently at version 1.33 for Minecraft 1.2.5.<br />
[[Changelog]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Wiki_Todo&diff=1477Wiki Todo2012-05-05T22:48:14Z<p>Onionnion: </p>
<hr />
<div>=== '''This page lists where work is needed to be done on the wiki. If you would like to help, we ask that you please make an account and help wherever you can.''' ===<br />
<br />
''Page currently incomplete, but being worked on.''<br />
<br />
== API Pages (Highest priorities are to finish function/method pages for API's) ==<br />
*[[HTTP_(API)|HTTP]] (Needs formatting and function pages)<br />
*[[OS_(API)|OS]] (I'll work on this one)<br />
*[[Parallel_(API)|Parallel]] (Can probably wait)<br />
*[[Peripheral_(API)|Peripheral]] (Mostly needs pages for functions)<br />
*[[Rednet_(API)|Rednet]] (Just minor formatting issues with the links; not urgent)<br />
*[[Redstone_(API)|Redstone]] (Needs pages for 3 functions)<br />
*[[Table_(API)|Table]] (Needs link to Lua reference page)<br />
*[[Term_(API)|Term]] (Needs function pages)<br />
*[[Textutils_(API)|Textutils]] (Needs function pages)<br />
*[[Vector_(API)|Vector]] (Needs link to page explaining or description explaining what a vector is)<br />
[[Category:Lists]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Template:Changelog&diff=1475Template:Changelog2012-05-05T22:45:08Z<p>Onionnion: Added 1.33 and fixed typo for 1.32. Not sure of any other additions for 1.33, please add if there were any others.</p>
<hr />
<div>{| class="wikitable sortable" style="width: 100%"<br />
|-<br />
! style="width: 15%" | Version<br />
! class="unsortable" | New Features or Changes<br />
! style="width: 15%" | Minecraft Version<br />
<br />
|-<br />
| style="text-align: center" | ComputerCraft 1.33<br />
|<br />
*Ported to Minecraft 1.2.5<br />
| style="text-align: center" | 1.2.5<br />
<br />
|-<br />
| style="text-align: center" | ComputerCraft 1.32<br />
|<br />
*Ported to Minecraft 1.2.4<br />
*Fixed a big memory leak in LuaJ that caused extra threads to stay around forever when computers were shut down.<br />
| style="text-align: center" | 1.2.4<br />
<br />
|-<br />
| style="text-align: center" | ComputerCraft 1.31<br />
|<br />
*Ported to Minecraft 1.2.3<br />
*Added Monitors (thanks to Cloudy). Build huge external displays for your computers!<br />
*New positioning capabilities for computers and turtles. Build GPS networks and triangulate the positions of your turtles position so they never get lost!<br />
*New turtle.compare() function for turtles for more intelligent mining.<br />
*New programs and APIs: gps, monitor, vector<br />
*New program: pastebin (requires enableAPI_HTTP=1 in mod_ComputerCraft.cfg), upload and download programs made by other users ingame!<br />
*Added a new top secret program designed for use with Monitors, see if you can find it.<br />
*Lots of additions to existing APIs and programs. Type "help whatsnew" in game for the full details.<br />
| style="text-align: center" | 1.2.3<br />
<br />
<br />
|-<br />
| style="text-align: center" | ComputerCraft 1.3<br />
|<br />
*Ported to Minecraft Forge.<br />
*Added Turtles, Mining Turtles, Wireless Turtles and Wireless Mining Turtles (Block ID 209).<br />
*Added a Peripheral API to allow mod developers to create custom peripherals for ComputerCraft. Details on this will be posted in the next few days.<br />
*Added Wireless Modems. Use the rednet API to send data wirelessly between computers and turtles!<br />
*Computers and Disk Drives no longer get destroyed by water.<br />
*Computers and Turtles can now be labelled, destroyed, and moved around, keeping their state.<br />
*Computers and Turtles can connect to adjacent devices, and turn them on or off.<br />
*User programs now give line numbers in their error messages, for easier debugging.<br />
*New APIs and programs for Turtles: turtle, excavate, tunnel, go, turn and dance.<br />
*Lots of additions to existing APIs and programs. Type "help whatsnew" in game for the full details.<br />
| style="text-align: center" | 1.1<br />
<br />
|-<br />
| style="text-align: center" | ComputerCraft 1.21<br />
|<br />
*Added shortcut key to shutdown the computer.<br />
*Added a help API add-on pack.<br />
*Various bug fixes.<br />
| style="text-align: center" | 1.1<br />
|-<br />
| style="text-align: center" | ComputerCraft 1.2<br />
|<br />
*Added Disk Drives<br />
*Added shortcut keys to terminate the current program and reboot the computer.<br />
*Added a new system for user created APIs.<br />
*Added RedNet.<br />
*Added shell.setPath() and shell.setAlias().<br />
*Added a new ROM startup script.<br />
*Added os.clock(), os.time(), and os.setAlarm().<br />
*Added game: "Worm!"<br />
*Added programs: alias, apis, copy, delete, dj, drive, eject, id, label, list, move, reboot, redset, rename, time, worm.<br />
*Added APIs: bit, colours, disk, help, rednet, parallel, textutils<br />
*Text can be edited with left and right arrow keys.<br />
*Many bug fixes<br />
| style="text-align: center" | 1.0<br />
|-<br />
| style="text-align: center" | ComputerCraft 1.11<br />
|<br />
*Fixed bug where [[Console|Computers]] could not read input from RedPower cables which had a bend in the immediately adjacent square.<br />
| style="text-align: center" | 1.0<br />
|-<br />
| style="text-align: center" | ComputerCraft 1.1<br />
|<br />
*Changed the default block ID for the [[Console|Computer]] to 207.<br />
*Added multiplayer support.<br />
*Added connectivity with RedPower bundled cables.<br />
*Added HTTP API<br />
*Fixed support for HD textures on the front of [[Console|Computers]].<br />
*Added command history to the [[Console]].<br />
*Added config options to change the size of the [[Console]] GUI and the text color.<br />
*Programs with infinite loops that don't yield will no longer freeze Minecraft and will terminate after 10 seconds.<br />
*Extended Help and fixed typos/small errors in various programs.<br />
| style="text-align: center" | 1.0<br />
|-<br />
| style="text-align: center" | ComputerCraft 1.02<br />
|<br />
*Fixed the MCPatcher HD textures incompatibility that was causing the computer texture to replace cobblestone blocks.<br />
| style="text-align: center" | 1.0<br />
|-<br />
| style="text-align: center" | ComputerCraft 1.01<br />
|<br />
*Added a ModLoader configuration file, so the computers block ID can be changed.<br />
*Made the error message that displays when Lua files are not correctly installed much more clear, no more "Assertion failed."<br />
| style="text-align: center" | 1.0<br />
|-<br />
| style="text-align: center" | ComputerCraft 1.0<br />
|<br />
*First Release<br />
| style="text-align: center" | 1.0<br />
|}</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Wiki_Todo&diff=1473Wiki Todo2012-05-05T22:36:28Z<p>Onionnion: Created page with "=== '''This page lists where work is needed to be done on the wiki. If you would like to help, we ask that you please make an account and help wherever you can.''' === ''Page..."</p>
<hr />
<div>=== '''This page lists where work is needed to be done on the wiki. If you would like to help, we ask that you please make an account and help wherever you can.''' ===<br />
<br />
''Page currently incomplete, but being worked on.''<br />
<br />
== API Pages (Highest priorities are to finish function/method pages for API's) ==<br />
*[[HTTP_(API)|HTTP]] (Needs formatting and function pages)<br />
*[[OS_(API)|OS]] (I'll work on this one)<br />
*[[Parallel_(API)|Parallel]] (Can probably wait)<br />
*[[Peripheral_(API)|Peripheral]] (Mostly needs pages for functions)<br />
*[[Rednet_(API)|Rednet]] (Just minor formatting issues with the links; not urgent)<br />
*[[Redstone_(API)|Redstone]] (Needs pages for 3 functions)<br />
*[[Table_(API)|Table]] (Needs link to Lua reference page)<br />
*[[Term_(API)|Term]] (Needs function pages)<br />
*[[Textutils_(API)|Textutils]] (Needs function pages)<br />
*[[Vector_(API)|Vector]] (Needs link to page explaining or description explaining what a vector is)</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=OS_(API)&diff=1458OS (API)2012-05-04T14:02:39Z<p>Onionnion: </p>
<hr />
<div><br />
''You may be looking for alternative OS's for ComputerCraft. If so, go to the [[list of oses|list of OSes]].''<br />
<br />
The Operating System API allows for interfacing with the Lua based Operating System itself.<br />
{| border="1" cellpadding="2" cellspacing="0"<br />
!style="background:#EEE" width="200px"|Method name<br />
!style="background:#EEE" width="*"|Description<br />
|-<br />
|[[os.version()]]<br />
|Returns the version of the OS the computer is running.<br />
|-<br />
|[[os.computerID()]]<br />
|Returns the unique ID of this computer.<br />
|-<br />
|[[os.getComputerLabel()]]<br />
|Returns the label of this computer.<br />
|-<br />
|[[os.setComputerLabel()]]<br />
|Set the label of this computer.<br />
|-<br />
|[[os.run( environment, programpath, arguments )]]<br />
|An advanced way of starting programs. A started program will have a given<br />
Environment table which determines what functions it has available, as well as<br />
any variables it will be able to access by default. You may prefer to use the<br />
[[Shell (API)]] unless you need to do something special.<br />
|-<br />
|[[#api|os.loadAPI( name )]]<br />
|Loads a lua script as an API, making it available to all programs.<br />
|-<br />
|[[#api|os.unloadAPI( name )]]<br />
|Unloads a previously loaded API.<br />
|-<br />
|[[Os.pullEvent()|os.pullEvent()]]<br />
|Blocks until the computer has detected an event, then returns the event.<br />
|-<br />
|[[#pullEvent|os.pullEventRaw()]]<br />
|Advanced version of pullEvent().<br />
|-<br />
|[[os.queueEvent()]]<br />
|<no description given><br />
|-<br />
|[[os.clock()]]<br />
|Returns CPU time.<br />
|-<br />
|[[os.startTimer( timeout )]]<br />
|Queues an event to be triggered after a number of seconds.<br />
The ID of the timer is returned from this function to differentiate multiple<br />
timers. Timers are one-shot, once they have fired an event you will need to<br />
start another one if you need a recurring timer.<br />
|-<br />
|[[os.sleep( timeout )]]<br />
|Makes the system wait a number of seconds before continuing in the program.<br />
May also be used as simply "sleep( timeout )".<br />
|-<br />
|[[os.time()]]<br />
|Returns the current Minecraft world time.<br />
|-<br />
|[[os.setAlarm( time )]]<br />
|Queues an event to be triggered at the specific Minecraft world time.<br />
|-<br />
|[[os.shutdown()]]<br />
|Turns off the computer.<br />
|-<br />
|[[os.reboot()]]<br />
|Reboots the computer.<br />
|}<br />
<br />
== <div id="api">API</div> ==<br />
<br />
API are programs which are loaded in to the OS itself, and expose functions<br />
which other programs may use. The stock [[Category:APIs|APIs that ship with<br />
ComputerCraft]] are loaded in this way, and may be replaced by a computer's<br />
user or programs.<br />
<br />
== <div id="pullEvent">os.pullEvent()</div> ==<br />
<br />
os.pullEvent() causes the current program to pause, retrieving the next event<br />
from the computer's queue of events. If there is no event to read, then the<br />
program will stall until such an event becomes available. Note that if a<br />
program has not attempted to pull an event in the past ten seconds, it will<br />
be forcefully terminated to prevent CPU waste in SMP environments.<br />
<br />
pullEvent returns the name of the event that was read, as well as up to<br />
five parameters:<br />
<br />
<code><br />
local event, p1, p2, p3, p4, p5 = os.pullEvent()<br />
</code><br />
<br />
os.pullEvent() is usually run inside a 'while true do' loop.<br />
<br />
An advanced version of this method <code>os.pullEventRaw</code> bypasses the<br />
normal handling of events from the OS. You may use this to act on the<br />
"Terminate" event (triggered when holding Ctrl-T) for custom termination logic.<br />
<br />
<!-- === Event names ===<br />
-- please wikitable this --<br />
*[[Raw key events|"key": keypress]]<br />
*"rednet_message": recieved a rednet message<br />
*"terminate" (? please verify name): Ctrl-T held<br />
--><br />
[[Category:APIs]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Shell_(API)&diff=1429Shell (API)2012-05-02T13:53:52Z<p>Onionnion: Added link to page explaining what a shell is.</p>
<hr />
<div>The shell API allows you to interface with the [http://en.wikipedia.org/wiki/Shell_%28computing%29 shell].<br />
<br />
{| border="1" cellpadding="2" cellspacing="0"<br />
!style="background:#EEE" width="200px"|Method name<br />
!style="background:#EEE" width="*"|Description<br />
|-<br />
|shell.exit()<br />
|Exits the program<br />
|-<br />
|shell.dir()<br />
|Returns the directory<br />
|-<br />
|shell.setDir( path )<br />
|Sets the directory<br />
|-<br />
|shell.path()<br />
|Returns the path<br />
|-<br />
|shell.setPath( path )<br />
|Sets the path<br />
|-<br />
|shell.resolve( localpath )<br />
|<no description given><br />
|-<br />
|shell.resolveProgram( name )<br />
|<no description given><br />
|-<br />
|shell.aliases()<br />
|Returns aliases.<br />
|-<br />
|shell.setAlias( alias, command )<br />
|Sets an alias.<br />
|-<br />
|shell.clearAlias( alias, command )<br />
|Clears an alias.<br />
|-<br />
|shell.programs()<br />
|Returns programs.<br />
|-<br />
|shell.run( program, arguments )<br />
|Runs a program.<br />
|-<br />
|shell.getRunningProgram()<br />
|Returns the absolute path to the currently-executing program.<br />
|}<br />
<br />
[[Category:APIs]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Peripheral_(API)&diff=1428Peripheral (API)2012-05-02T13:48:16Z<p>Onionnion: Added link to Wikipedia page explaining peripherals</p>
<hr />
<div>The peripheral API is for interacting with external [http://en.wikipedia.org/wiki/Peripheral peripherals], such as the disk drive and monitor.<br />
{| border="1" cellpadding="2" cellspacing="0"<br />
!style="background:#EEE" width="210px"|Method name<br />
!style="background:#EEE" width="*"|Description<br />
|-<br />
|peripheral.isPresent( side )<br />
|Returns '''true''' if a peripheral is present on ''side''.<br />
|-<br />
|peripheral.getType( side )<br />
|Returns the type or peripheral present on ''side'', nothing returned if ''side'' is empty.<br />
|-<br />
|peripheral.getMethods( side )<br />
|Returns a table containing all methods for peripheral on ''side''.<br />
|-<br />
|peripheral.call( side, methodName, param1, param2, ... )<br />
|Sends a function call to peripheral located on ''side''. Return values match those of called method.<br /><br />
'''Note:''' ''methodName'' is a string.<br />
|-<br />
|peripheral.wrap( side )<br />
|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.:<br /><br />
fdd = peripheral.wrap("left")<br /><br />
fdd.isPresent()<br /><br />
''- is the same as -''<br /><br />
peripheral.call("left","isPresent")<br />
|}<br />
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'', ''shutdown'', ''reboot'', ''getID''.<br />
[[Category:APIs]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Talk:Making_a_Password_Protected_Door&diff=1423Talk:Making a Password Protected Door2012-05-01T13:38:01Z<p>Onionnion: /* Needs work */ new section</p>
<hr />
<div><br />
== Re: "Make code better, again" ==<br />
<br />
How is it 'better' to leave the computer running when it's not needed?<br />
Assuming this is the desired behaviour, why is it 'better' to reboot the computer each time instead of using a loop?<br />
And assuming ''that'' is the desired behaviour, why is it 'better' to have the call to os.reboot() repeated inside the if blocks instead of once after the if?<small><span class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[User:2.102.58.164|2.102.58.164]] ([[User talk:2.102.58.164|talk]] • [[Special:Contributions/2.102.58.164|contribs]]) </span></small><!-- Template:Unsigned --><br />
<br />
:Loop uses more memory. Also, there's no difference, do you really care that much? <small><span class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[User:24.20.22.206|24.20.22.206]] ([[User talk:24.20.22.206|talk]] • [[Special:Contributions/24.20.22.206|contribs]]) </span></small><!-- Template:Unsigned --><br />
::I reverted changes from two users. This guide is supposed to be a reasonably low level tutorial. Simply slapping code on a page is not a tutorial, hence the previous version with screen shots is more noob friendly. Secondly, the latter version used variables that don't need to be variables. [[Special:Contributions/121.45.75.253|121.45.75.253]] 14:07, 16 April 2012 (UTC)<br />
<br />
== I think this can be more "Noob" friendly ==<br />
<br />
i am a noob and have just started to use Computer Craft. I was learning how to make a password protected lock and i understood all of it, until it said, " Now to start it, we have the computer call the function after it declares it." This confused me very much and i was hoping someone could clarify or edit the page to be even more "Noob" friendly. <small><span class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[User:Tpomdreams|Tpomdreams]] ([[User talk:Tpomdreams|talk]] • [[Special:Contributions/Tpomdreams|contribs]]) </span></small><!-- Template:Unsigned --><br />
<br />
:Try the 'Better / Alternative Code', you might understand that more. <small><span class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[User:24.20.22.206|24.20.22.206]] ([[User talk:24.20.22.206|talk]] • [[Special:Contributions/24.20.22.206|contribs]]) </span></small><!-- Template:Unsigned --><br />
<br />
== Needs work ==<br />
<br />
Should be formatted better and especially with the code and the comments.</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Talk:Disk_(API)&diff=712Talk:Disk (API)2012-02-29T22:35:54Z<p>Onionnion: </p>
<hr />
<div>I think the API's based on objects should be listed on their objects page with a tag to the API section.<br />
--[[User:Onionnion|Onionnion]] 14:44, 28 February 2012 (UTC)<br />
:What do you mean? Like listing the floppy disk and disk drive on the Disk API page? {{User:Scarfacial/Signature|17:23 - 28 February 2012}}<br />
:To have the page for the object's API be put into a subject on the object's page and have the API page redirect to the object's API category. --[[User:Onionnion|Onionnion]] 22:35, 29 February 2012 (UTC)</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Talk:Disk_(API)&diff=704Talk:Disk (API)2012-02-28T14:44:44Z<p>Onionnion: Created page with "I think the API's based on objects should be listed on their objects page with a tag to the API section. --~~~~"</p>
<hr />
<div>I think the API's based on objects should be listed on their objects page with a tag to the API section.<br />
--[[User:Onionnion|Onionnion]] 14:44, 28 February 2012 (UTC)</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Disk_Drive&diff=703Disk Drive2012-02-28T14:42:10Z<p>Onionnion: </p>
<hr />
<div>The disk drive arrived with the ComputerCraft 1.2 update and with that also came [[Floppy Disk]]s. The disk drive is an object that, when placed adjacently but not diagonally next to a computer, does the same as a disk drive for real computers in the real world would do: they allow the access to portable data storage devices ([[Floppy Disk]]s).[[File:CR4mm.png|frame|right|The recipe for a disk drive.]]<br />
<br />
== Usage ==<br />
To use a disk drive, place it adjacently but not diagonally next to a computer (left, right, top, bottom, front, or back side). Insert a disk by right-clicking on the disk drive and placing the disk in the slot above the inventory.[[File:DiskDriveGUI.png|thumb|350px|GUI of the Disk Drive]]<br />
<br />
== API ==<br />
See [[Disk (API)]] for the disk API.<br />
<br />
<br />
[[Category:Blocks]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Worm&diff=573Worm2012-02-26T03:07:33Z<p>Onionnion: </p>
<hr />
<div>[[image:2012-01-30 22.51.36.png|thumb|400px|Gameplay of Worm.]]Worm is a default program. Most LPs about this mod will consist of the LPer playing Worm. Worm is essentially Snake without walls; instead of hitting a wall and dying, the worm will wrap around the screen. Worm has three difficulties.<br />
<br />
[[Category:Notable Software]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Floppy_Disk&diff=559Floppy Disk2012-02-26T02:35:40Z<p>Onionnion: </p>
<hr />
<div>The system of disks and floppies in ComputerCraft were added in version 1.2. How they work and interact with the computers is very similar to how they would work in the real world with our real computers: There's a [[Disk Drive]] that we're able to insert removable disks (or floppies) which we're able to place data upon, which, in turn, makes data portable. This brings much potential for things such as servers running ComputerCraft and users of that server wishing to distribute their software for in-game currency.[[File:Wwc1P.png|frame|right|The recipe for a floppy disk.]]<br />
<br />
== Usage ==<br />
Like individual computers, each floppy disk has its own folder containing the data that is within that floppy and is easily movable from within the computers in Minecraft using the simple UNIX-like commands such as cp (copy) or mv (move). Just like anywhere else in a computer, you can create, edit, move, copy, etc., any files and do so however you wish.<br />
<br />
To insert a floppy into a disk drive so it can be used, right-click the disk drive and place the floppy into the slot at the top of the drive's inventory menu.<br />
<br />
== Interacting with Computers ==<br />
When a disk is inserted into a disk drive that is in a block and is adjacently (but not diagonally) connected to a computer, a directory is visible in the computer's root directory titled 'disk'. If another disk is inserted into a different drive that is also connected to a computer then that next directory is entitled 'disk2' and so-on for each additional disk that is inserted and connected.<br />
<br />
[[Category:Items]]<br />
<br />
== Release Changes ==<br />
*'''1.3''': Used for [[Turtle]]s' programming.<br />
*'''1.2''': Initial Release<br />
<br />
<br />
--[[User:Onionnion|Onionnion]] 02:35, 26 February 2012 (UTC)</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Floppy_Disk&diff=558Floppy Disk2012-02-26T02:35:24Z<p>Onionnion: </p>
<hr />
<div>The system of disks and floppies in ComputerCraft were added in version 1.2. How they work and interact with the computers is very similar to how they would work in the real world with our real computers: There's a [[Disk Drive]] that we're able to insert removable disks (or floppies) which we're able to place data upon, which, in turn, makes data portable. This brings much potential for things such as servers running ComputerCraft and users of that server wishing to distribute their software for in-game currency.[[File:Wwc1P.png|frame|right|The recipe for a floppy disk.]]<br />
<br />
== Usage ==<br />
Like individual computers, each floppy disk has its own folder containing the data that is within that floppy and is easily movable from within the computers in Minecraft using the simple UNIX-like commands such as cp (copy) or mv (move). Just like anywhere else in a computer, you can create, edit, move, copy, etc., any files and do so however you wish.<br />
<br />
To insert a floppy into a disk drive so it can be used, right-click the disk drive and place the floppy into the slot at the top of the drive's inventory menu.<br />
<br />
== Interacting with Computers ==<br />
When a disk is inserted into a disk drive that is in a block and is adjacently (but not diagonally) connected to a computer, a directory is visible in the computer's root directory titled 'disk'. If another disk is inserted into a different drive that is also connected to a computer then that next directory is entitled 'disk2' and so-on for each additional disk that is inserted and connected.<br />
<br />
[[Category:Items]]<br />
<br />
== Release Changes ==<br />
*'''1.3''': Used for [[Turtle]]s' programming.<br />
*'''1.2''': Initial Release<br />
<br />
--[[User:Onionnion|Onionnion]] 02:35, 26 February 2012 (UTC)</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Floppy_Disk&diff=544Floppy Disk2012-02-26T01:14:22Z<p>Onionnion: Clearing things up; making explanations for how things work</p>
<hr />
<div>The system of disks and floppies in ComputerCraft were added in version 1.2. How they work and interact with the computers is very similar to how they would work in the real world with our real computers: There's a [[Disk Drive]] that we're able to insert removable disks (or floppies) which we're able to place data upon, which, in turn, makes data portable. This brings much potential for things such as servers running ComputerCraft and users of that server wishing to distribute their software for in-game currency.[[File:Wwc1P.png|frame|right|The recipe for a floppy disk.]]<br />
<br />
== Usage ==<br />
Like individual computers, each floppy disk has its own folder containing the data that is within that floppy and is easily movable from within the computers in Minecraft using the simple UNIX-like commands such as cp (copy) or mv (move). Just like anywhere else in a computer, you can create, edit, move, copy, etc., any files and do so however you wish.<br />
<br />
To insert a floppy into a disk drive so it can be used, right-click the disk drive and place the floppy into the slot at the top of the drive's inventory menu.<br />
<br />
== Interacting with Computers ==<br />
When a disk is inserted into a disk drive that is in a block and is adjacently (but not diagonally) connected to a computer, a directory is visible in the computer's root directory titled 'disk'. If another disk is inserted into a different drive that is also connected to a computer then that next directory is entitled 'disk2' and so-on for each additional disk that is inserted and connected.<br />
<br />
[[Category:Items]]<br />
<br />
== Release Changes ==<br />
*'''1.3''': Used for [[Turtle]]s' programming.<br />
*'''1.2''': Initial Release</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Disk_(API)&diff=543Disk (API)2012-02-26T00:52:32Z<p>Onionnion: </p>
<hr />
<div>''If you were looking for disks as-in Floppies, go to [[Floppy Disk]].''<br />
<br />
<br />
The Disk API allows you to mess around with disk drives.<br />
<br />
{| border="1" cellpadding="2" cellspacing="0"<br />
!style="background:#EEE" width="200px"|Method name<br />
!style="background:#EEE" width="*"|Description<br />
|-<br />
|disk.isPresent( side )<br />
|Checks the given side for a disk<br />
|-<br />
|disk.hasData( side )<br />
|Checks the disk for data<br />
|-<br />
|disk.getMountPath( side )<br />
|Returns the directory path on which the disk on '''side''' has been mount (ex. /disk)<br />
|-<br />
|disk.setLabel( side )<br />
|Sets the label<br />
|-<br />
|disk.getLabel( side )<br />
|Finds label<br />
|-<br />
|disk.hasAudio( side )<br />
|Checks if the disk is a music disk<br />
|-<br />
|disk.playAudio( side )<br />
|Plays the audio<br />
|-<br />
|disk.stopAudio( side )<br />
|Stops the audio<br />
|-<br />
|disk.eject( side )<br />
|Ejects the disk.<br />
|}<br />
[[Category:APIs]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Category:APIs&diff=250Category:APIs2012-02-10T03:16:31Z<p>Onionnion: </p>
<hr />
<div>[[File:Apis.png|thumb|350px|API's being listed with the 'apis' command run in a computer.]]An API (Application Programming Interface) is a fairly large block of code inserted or called into a program to ease on the coder. An example is a game development API that adds in features that make game development easier.<br />
<br />
Currently there are 20 default API's that come with ComputerCraft: [[bit (API)|bit]], [[color (API)|color]], [[color (API)|colour]] (same as colors), [[coroutine (API)|coroutine]], [[disk (API)|disk]], [[fs (API)|fs]], [[help (API)|help]], [[HTTP (API)|http]], [[IO (API)|io]], [[math (API)|math]], [[OS (API)|OS]], [[parallel (API)|parallel]], [[rednet (API)|rednet]], [[redstone (API)|redstone]], [[redstone (API)|rs]] (shortened redstone), [[shell (API)|shell]], [[string (API)|string]], [[table (API)|table]], [[term (API)|term]], and [[textutils (API)|textutils]]. Users can also use their own API's.<br />
<br />
Users can view all the currently enabled API's by entering 'api' in their terminal.<br />
<br />
APIs can be used in one of 3 ways. They can be inserted directly into the code, called in through means of running it at the same time as the other code or it can be run all the time by the BIOS. So far however, there are no APIs that run straight from the BIOS, that's just a theory.<br />
<br />
APIs tend to be ~200 lines of code. Some APIs may be used as databases or memory storage for people. Some may be serial encoders/decoders, and some may be to assist in other forms of coding.<br />
<br />
----<br />
<br />
<br />
Here is a list of all APIs for ComputerCraft:<br />
<br />
[[Category:Lists]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Talk:ComputerCraft_Wiki:Mainpage&diff=231Talk:ComputerCraft Wiki:Mainpage2012-02-05T05:23:03Z<p>Onionnion: </p>
<hr />
<div>Hello, wiki. This page needs to be more professional seeming. --[[User:Kaleb702|if user &#61;&#61; 1 then print(&#34;Kaleb702&#34;); end]] 01:43, 29 January 2012 (UTC)<br />
<br />
In what ways can it look more professional? --[[User:Onionnion|Onionnion]] 05:23, 5 February 2012 (UTC)</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=User:Onionnion&diff=229User:Onionnion2012-02-05T05:15:42Z<p>Onionnion: Created page with "Onionnion likes onions."</p>
<hr />
<div>Onionnion likes onions.</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=OS_(API)&diff=226OS (API)2012-02-05T05:11:35Z<p>Onionnion: </p>
<hr />
<div>''You may be looking for alternative OS's for ComputerCraft. If so, go to the [[list of OS's]].''<br />
<br />
The Operating System API allows for interfacing with the Lua based Operating System itself.<br />
{| border="1" cellpadding="2" cellspacing="0"<br />
!style="background:#EEE" width="200px"|Method name<br />
!style="background:#EEE" width="*"|Description<br />
|-<br />
|os.version()<br />
|Returns version<br />
|-<br />
|os.computerID()<br />
|Returns the ID of the computer<br />
|-<br />
|os.run( environment, programpath, arguments )<br />
|<no description given><br />
|-<br />
|os.loadAPI( name )<br />
|Loads the API given.<br />
|-<br />
|os.unloadAPI( name )<br />
|Unloads the API given.<br />
|-<br />
|[[#pullEvent|os.pullEvent()]]<br />
|<no description given><br />
|-<br />
|os.queueEvent()<br />
|<no description given><br />
|-<br />
|os.clock()<br />
|Returns CPU time.<br />
|-<br />
|os.startTimer( timeout )<br />
|<no description given><br />
|-<br />
|os.sleep( timeout )<br />
|Makes the system wait before continuing in the program.<br />
|-<br />
|os.time()<br />
|Returns MineCraft time.<br />
|-<br />
|os.setAlarm( time )<br />
|<no description given><br />
|-<br />
|os.shutdown()<br />
|Turns off the computer.<br />
|-<br />
|os.reboot()<br />
|Reboots the computer.<br />
|}<br />
<br />
<br />
== <div id="pullEvent">os.pullEvent()</div> ==<br />
<br />
The pullEvent() function allows the computer to check if a certain event has occurred and acts upon that event through 'if' and 'elseif' statements. os.pullEvent() is usually run inside a 'while true do' loop.<br />
<br />
[[Category:APIs]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=OS_(API)&diff=225OS (API)2012-02-05T05:10:25Z<p>Onionnion: /* os.pullEvent() */</p>
<hr />
<div>''You may be looking for alternative OS's for ComputerCraft. If so, go to the [[list of OS's]].''<br />
<br />
The Operating System API allows for interfacing with the Lua based Operating System itself.<br />
{| border="1" cellpadding="2" cellspacing="0"<br />
!style="background:#EEE" width="200px"|Method name<br />
!style="background:#EEE" width="*"|Description<br />
|-<br />
|os.version()<br />
|Returns version<br />
|-<br />
|os.computerID()<br />
|Returns the ID of the computer<br />
|-<br />
|os.run( environment, programpath, arguments )<br />
|<no description given><br />
|-<br />
|os.loadAPI( name )<br />
|Loads the API given.<br />
|-<br />
|os.unloadAPI( name )<br />
|Unloads the API given.<br />
|-<br />
|[[#pullEvent|os.pullEvent()]]<br />
|<no description given><br />
|-<br />
|os.queueEvent()<br />
|<no description given><br />
|-<br />
|os.clock()<br />
|Returns CPU time.<br />
|-<br />
|os.startTimer( timeout )<br />
|<no description given><br />
|-<br />
|os.sleep( timeout )<br />
|Makes the system wait before continuing in the program.<br />
|-<br />
|os.time()<br />
|Returns MineCraft time.<br />
|-<br />
|os.setAlarm( time )<br />
|<no description given><br />
|-<br />
|os.shutdown()<br />
|Turns off the computer.<br />
|-<br />
|os.reboot()<br />
|Reboots the computer.<br />
|}<br />
<br />
== <div id="pullEvent">os.pullEvent()</div> ==<br />
<br />
The pullEvent() function allows the computer to check if a certain event has occurred and acts upon that event through 'if' and 'elseif' statements. os.pullEvent() is usually run inside a 'while true do' loop.<br />
<br />
[[Category:APIs]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=OS_(API)&diff=224OS (API)2012-02-05T05:09:01Z<p>Onionnion: </p>
<hr />
<div>''You may be looking for alternative OS's for ComputerCraft. If so, go to the [[list of OS's]].''<br />
<br />
The Operating System API allows for interfacing with the Lua based Operating System itself.<br />
{| border="1" cellpadding="2" cellspacing="0"<br />
!style="background:#EEE" width="200px"|Method name<br />
!style="background:#EEE" width="*"|Description<br />
|-<br />
|os.version()<br />
|Returns version<br />
|-<br />
|os.computerID()<br />
|Returns the ID of the computer<br />
|-<br />
|os.run( environment, programpath, arguments )<br />
|<no description given><br />
|-<br />
|os.loadAPI( name )<br />
|Loads the API given.<br />
|-<br />
|os.unloadAPI( name )<br />
|Unloads the API given.<br />
|-<br />
|[[#pullEvent|os.pullEvent()]]<br />
|<no description given><br />
|-<br />
|os.queueEvent()<br />
|<no description given><br />
|-<br />
|os.clock()<br />
|Returns CPU time.<br />
|-<br />
|os.startTimer( timeout )<br />
|<no description given><br />
|-<br />
|os.sleep( timeout )<br />
|Makes the system wait before continuing in the program.<br />
|-<br />
|os.time()<br />
|Returns MineCraft time.<br />
|-<br />
|os.setAlarm( time )<br />
|<no description given><br />
|-<br />
|os.shutdown()<br />
|Turns off the computer.<br />
|-<br />
|os.reboot()<br />
|Reboots the computer.<br />
|}<br />
<br />
== <div id="pullEvent">os.pullEvent()</div> ==<br />
<br />
The pullEvent() function is part of the [[OS]] API. It allows the computer to check if a certain event has occurred and acts upon that event through 'if' and 'elseif' statements. os.pullEvent() is usually run inside a 'while true do' loop.<br />
<br />
[[Category:APIs]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=OS_(API)&diff=221OS (API)2012-02-05T04:49:52Z<p>Onionnion: </p>
<hr />
<div>''You may be looking for alternative OSes for ComputerCraft. If so, go to the list of OSes.''<br />
<br />
The Operating System API allows for interfacing with the Lua based Operating System itself.<br />
{| border="1" cellpadding="2" cellspacing="0"<br />
!style="background:#EEE" width="200px"|Method name<br />
!style="background:#EEE" width="*"|Description<br />
|-<br />
|os.version()<br />
|Returns version<br />
|-<br />
|os.computerID()<br />
|Returns the ID of the computer<br />
|-<br />
|os.run( environment, programpath, arguments )<br />
|<no description given><br />
|-<br />
|os.loadAPI( name )<br />
|Loads the API given.<br />
|-<br />
|os.unloadAPI( name )<br />
|Unloads it.<br />
|-<br />
|[[PullEvent|os.pullEvent()]]<br />
|<no description given><br />
|-<br />
|os.queueEvent()<br />
|<no description given><br />
|-<br />
|os.clock()<br />
|Returns CPU time.<br />
|-<br />
|os.startTimer( timeout )<br />
|<no description given><br />
|-<br />
|os.sleep( timeout )<br />
|Makes the system wait before continuing in the program.<br />
|-<br />
|os.time()<br />
|Returns MineCraft time.<br />
|-<br />
|os.setAlarm( time )<br />
|<no description given><br />
|-<br />
|os.shutdown()<br />
|Turns off the computer.<br />
|-<br />
|os.reboot()<br />
|Reboots the computer.<br />
|}<br />
[[Category:APIs]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Rednet_(API)&diff=220Rednet (API)2012-02-05T04:45:01Z<p>Onionnion: </p>
<hr />
<div>The rednet API provides a simple computer networking model over RedPower bundled cables.<br />
With the table below, 'side' refers to a string that represents a side of the computer ("front", "back", "left", "right", "bottom", "top"). All message sent with rednet are and must be strings.<br />
{| border="1" cellpadding="2" cellspacing="0"<br />
!style="background:#EEE" width="200px"|Method name<br />
!style="background:#EEE" width="*"|Description<br />
|-<br />
|rednet.open( side )<br />
|Tells the computer that the side can be used for networking.<br />
|-<br />
|rednet.close( side )<br />
|Tells the computer that the side can no longer be used for networking.<br />
|-<br />
|rednet.announce()<br />
|Broadcasts an empty rednet message.<br />
|-<br />
|rednet.send( receiverID, message )<br />
|Sends a message to the computer using the opened sides. The receiver ID is the ID (number, not string) of the computer you're sending the message to.<br />
|-<br />
|rednet.broadcast( message )<br />
|Sends the message to ALL connected and open computers.<br />
|-<br />
|rednet.receive( timeout )<br />
|Sets an amount of time to wait for a rednet message input. If you wanted to have the computer wait for an input for 5 seconds, then the code would be: rednet.receive( 5 )<br />
|}<br />
You can also handle the "rednet_message" event to receive messages without calling receive(), the arguments are the same as the receive() return values.<br />
[[Category:APIs]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Category:APIs&diff=218Category:APIs2012-02-04T19:15:31Z<p>Onionnion: </p>
<hr />
<div>[[File:Apis.png|thumb]]An API (Application Programming Interface) is a fairly large block of code inserted or called into a program to ease on the coder. An example is a game development API that adds in features that make game development easier.<br />
<br />
Currently there are 20 default API's that come with ComputerCraft: [[bit (API)|bit]], [[color (API)|color]], [[color (API)|colour]] (same as colors), [[coroutine (API)|coroutine]], [[disk (API)|disk]], [[fs (API)|fs]], [[help (API)|help]], [[HTTP (API)|http]], [[IO (API)|io]], [[math (API)|math]], [[OS (API)|OS]], [[parallel (API)|parallel]], [[rednet (API)|rednet]], [[redstone (API)|redstone]], [[redstone (API)|rs]] (shortened redstone), [[shell (API)|shell]], [[string (API)|string]], [[table (API)|table]], [[term (API)|term]], and [[textutils (API)|textutils]]. Users can also use their own API's.<br />
<br />
Users can view all the currently enabled API's by entering 'api' in their terminal.<br />
<br />
APIs can be used in one of 3 ways. They can be inserted directly into the code, called in through means of running it at the same time as the other code or it can be run all the time by the BIOS. So far however, there are no APIs that run straight from the BIOS, that's just a theory.<br />
<br />
APIs tend to be ~200 lines of code. Some APIs may be used as databases or memory storage for people. Some may be serial encoders/decoders, and some may be to assist in other forms of coding.<br />
<br />
----<br />
<br />
<br />
Here is a list of all APIs for ComputerCraft:<br />
<br />
[[Category:Lists]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Category:APIs&diff=217Category:APIs2012-02-04T19:14:05Z<p>Onionnion: </p>
<hr />
<div>[[File:Apis.png|thumb]]An API (Application Programming Interface) is a fairly large block of code inserted or called into a program to ease on the coder. An example is a game development API that adds in features that make game development easier.<br />
<br />
Currently there are 20 default API's that come with ComputerCraft: [[bit (API)|bit]], [[color (API)|color]], [[color (API)|colour]] (same as colors), [[coroutine (API)|coroutine]], [[disk (API)|disk]], [[fs (API)|fs]], [[help (API)|help]], [[HTTP (API)|http]], [[IO (API)|io]], [[math (API)|math]], [[OS (API)|OS]], [[parallel (API)|parallel]], [[rednet (API)|rednet]], [[redstone (API)|redstone]], [[redstone (API)|rs]] (shortened redstone), [[shell (API)|shell]], [[string (API)|string]], [[table (API)|table]], [[term (API)|term]], and [[textutils (API)|textutils]]. Users can also use their own API's.<br />
<br />
Users can view all the currently enabled API's by entering 'api' in their terminal.<br />
<br />
APIs can be used in one of 3 ways. They can be inserted directly into the code, called in through means of running it at the same time as the other code or it can be run all the time by the BIOS. So far however, there are no APIs that run straight from the BIOS, that's just a theory.<br />
<br />
APIs tend to be ~200 lines of code. Some APIs may be used as databases or memory storage for people. Some may be serial encoders/decoders, and some may be to assist in other forms of coding.<br />
<br />
----<br />
<br />
Here is a list of all APIs for ComputerCraft.<br />
<br />
[[Category:Lists]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Rs_(API)&diff=215Rs (API)2012-02-04T19:09:56Z<p>Onionnion: </p>
<hr />
<div>#REDIRECT [[Redstone (API)]]<br />
[[Category:APIs]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Redstone_(API)&diff=214Redstone (API)2012-02-04T19:09:03Z<p>Onionnion: </p>
<hr />
<div><br />
<br />
== Description ==<br />
<br />
The redstone API contains methods to control attached RedPower cables/bundled cables<br />
<br />
== Methods ==<br />
<br />
{| border="1" cellpadding="2" cellspacing="0"<br />
!style="background:#EEE" width="200px"|Method name<br />
!style="background:#EEE" width="*"|Description<br />
|-<br />
|[[Redstone_getBundledInput(side)|getBundledInput]]( side )<br />
|<br />
|-<br />
|[[Redstone_getBundledOutput|getBundledOutput]]( side )<br />
|returns the state of a redpower wire inside a bundle connected to ''side''<br />
|-<br />
|[[Redstone_setBundledOutput|setBundledOutput]]( side, colors )<br />
|Sets one or multiple colored signals in a redpower bundled wire connected to ''Side''<br />
|-<br />
|[[Redstone_testBundledInput|testBundledInput]]( side, color )<br />
|Returns true or false whether or not a colored signal is active in a redpower bundled wire connected to ''Side''<br />
|-<br />
|[[Redstone_getInput|getInput]]( side )<br />
|Returns the current redstone signal state on ''side''<br />
|-<br />
|[[Redstone_getSides|getSides]]()<br />
|Returns an array of possible sides<br />
|-<br />
|[[Redstone_setOutput|setOutput]]( side,boolean )<br />
|Set or reset a redstone signal on ''side'' <br />
|}<br />
<br />
<br />
[[Category:APIs]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Category:APIs&diff=212Category:APIs2012-02-04T19:05:10Z<p>Onionnion: </p>
<hr />
<div>[[File:Apis.png|thumb]]An API (Application Programming Interface) is a fairly large block of code inserted or called into a program to ease on the coder. An example is a game development API that adds in features that make game development easier.<br />
<br />
Currently there are 20 default API's that come with ComputerCraft: [[bit (API)|bit]], [[colors (API)|colors]], [[colors (API)|colours]] (same as colors), [[coroutine (API)|coroutine]], [[disk (API)|disk]], [[fs (API)|fs]], [[help (API)|help]], [[http (API)|http]], [[io (API)|io]], [[math (API)|math]], [[os (API)|os]], [[parallel (API)|parallel]], [[rednet (API)|rednet]], [[redstone (API)|redstone]], [[redstone (API)|rs]] (shortened redstone), [[shell (API)|shell]], [[string (API)|string]], [[table (API)|table]], [[term (API)|term]], and [[textutils (API)|textutils]]. Users can also use their own API's.<br />
<br />
Users can view all the currently enabled API's by entering 'api' in their terminal.<br />
<br />
APIs can be used in one of 3 ways. They can be inserted directly into the code, called in through means of running it at the same time as the other code or it can be run all the time by the BIOS. So far however, there are no APIs that run straight from the BIOS, that's just a theory.<br />
<br />
APIs tend to be ~200 lines of code. Some APIs may be used as databases or memory storage for people. Some may be serial encoders/decoders, and some may be to assist in other forms of coding.<br />
<br />
----<br />
<br />
Here is a list of all APIs for ComputerCraft.<br />
<br />
[[Category:Lists]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Redstone_(API)&diff=210Redstone (API)2012-02-04T19:03:23Z<p>Onionnion: moved Rs (API) to Redstone (API)</p>
<hr />
<div><br />
<br />
== Description ==<br />
<br />
The redstone API contains methods to control attached RedPower cables/bundled cables<br />
<br />
== Methods ==<br />
<br />
{| border="1" cellpadding="2" cellspacing="0"<br />
!style="background:#EEE" width="200px"|Method name<br />
!style="background:#EEE" width="*"|Description<br />
|-<br />
|[[Redstone_getBundledInput(side)|getBundledInput]]( side )<br />
|<br />
|-<br />
|[[Redstone_getBundledOutput|getBundledOutput]]( side )<br />
|returns the state of a redpower wire inside a bundle connected to ''side''<br />
|-<br />
|[[Redstone_setBundledOutput|setBundledOutput]]( side, colors )<br />
|Sets one or multiple colored signals in a redpower bundled wire connected to ''Side''<br />
|-<br />
|[[Redstone_testBundledInput|testBundledInput]]( side, color )<br />
|Returns true or false whether or not a colored signal is active in a redpower bundled wire connected to ''Side''<br />
|-<br />
|[[Redstone_getInput|getInput]]( side )<br />
|Returns the current redstone signal state on ''side''<br />
|-<br />
|[[Redstone_getSides|getSides]]()<br />
|Returns an array of possible sides<br />
|-<br />
|[[Redstone_setOutput|setOutput]]( side,boolean )<br />
|Set or reset a redstone signal on ''side'' <br />
|}<br />
<br />
<br />
[[Category:API]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Rs_(API)&diff=211Rs (API)2012-02-04T19:03:23Z<p>Onionnion: moved Rs (API) to Redstone (API)</p>
<hr />
<div>#REDIRECT [[Redstone (API)]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Redstone_(API)&diff=209Redstone (API)2012-02-04T19:03:00Z<p>Onionnion: </p>
<hr />
<div><br />
<br />
== Description ==<br />
<br />
The redstone API contains methods to control attached RedPower cables/bundled cables<br />
<br />
== Methods ==<br />
<br />
{| border="1" cellpadding="2" cellspacing="0"<br />
!style="background:#EEE" width="200px"|Method name<br />
!style="background:#EEE" width="*"|Description<br />
|-<br />
|[[Redstone_getBundledInput(side)|getBundledInput]]( side )<br />
|<br />
|-<br />
|[[Redstone_getBundledOutput|getBundledOutput]]( side )<br />
|returns the state of a redpower wire inside a bundle connected to ''side''<br />
|-<br />
|[[Redstone_setBundledOutput|setBundledOutput]]( side, colors )<br />
|Sets one or multiple colored signals in a redpower bundled wire connected to ''Side''<br />
|-<br />
|[[Redstone_testBundledInput|testBundledInput]]( side, color )<br />
|Returns true or false whether or not a colored signal is active in a redpower bundled wire connected to ''Side''<br />
|-<br />
|[[Redstone_getInput|getInput]]( side )<br />
|Returns the current redstone signal state on ''side''<br />
|-<br />
|[[Redstone_getSides|getSides]]()<br />
|Returns an array of possible sides<br />
|-<br />
|[[Redstone_setOutput|setOutput]]( side,boolean )<br />
|Set or reset a redstone signal on ''side'' <br />
|}<br />
<br />
<br />
[[Category:API]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Turtle_(API)&diff=207Turtle (API)2012-02-04T19:01:40Z<p>Onionnion: moved Turtle API to Turtle (API)</p>
<hr />
<div>The Turtle API is a default API for [[TurtleOS]]. Its functions are unknown, but they contain movement in all 3 dimensions (Turtles fly), block placement, and block destruction functions.<br />
<br />
[[Category:APIs]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Textutils_(API)&diff=205Textutils (API)2012-02-04T19:01:30Z<p>Onionnion: moved TEXTUTILS to Textutils (API)</p>
<hr />
<div>Text utilities is used to mess around with text easier.<br />
<br />
Its functions include:<br />
{| border="1" cellpadding="2" cellspacing="0"<br />
!style="background:#EEE" width="200px"|Method name<br />
!style="background:#EEE" width="*"|Description<br />
|-<br />
|textutils.slowPrint( text )<br />
|Slowly prints the text.<br />
|-<br />
|textutils.tabulate( table, table2, so on)<br />
|<no description given><br />
|-<br />
|textutils.formatTime( time, bTwentyFourHour)<br />
|Put a time into it, and it spews it out in a different format.<br />
|}<br />
<br />
[[Category:APIs]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Term_(API)&diff=203Term (API)2012-02-04T19:01:12Z<p>Onionnion: moved TERM to Term (API)</p>
<hr />
<div>The Terminal API provides functions for ASCII graphics.<br />
{| border="1" cellpadding="2" cellspacing="0"<br />
!style="background:#EEE" width="200px"|Method name<br />
!style="background:#EEE" width="*"|Description<br />
|-<br />
|term.write( text )<br />
|Writes text to the screen.<br />
|-<br />
|term.clear()<br />
|Clears the entire screen<br />
|-<br />
|term.clearLine()<br />
|Clears the line the cursor is on<br />
|-<br />
|term.getCursorPos()<br />
|Returns position of the cursor<br />
|-<br />
|term.setCursorPos( x, y )<br />
|Sets the cursor's position.<br />
|-<br />
|term.setCursorBlink( b )<br />
|Disables the blinking or turns it on.<br />
|-<br />
|term.getSize()<br />
|Gets the size of the screen. (Good for if you're making something to be compatible with both [[Turtles]] and [[Consoles]].<br />
|-<br />
|term.scroll( n )<br />
|Scrolls the terminal.<br />
|}<br />
[[Category:APIs]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Table_(API)&diff=201Table (API)2012-02-04T19:00:55Z<p>Onionnion: moved Table to Table (API)</p>
<hr />
<div>The table API is a default Lua 5.1 API. Please list any non-working functions below.<br />
<br />
List of non-working functions:<br />
<br />
[[category:APIs]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=String_(API)&diff=199String (API)2012-02-04T19:00:49Z<p>Onionnion: moved String to String (API)</p>
<hr />
<div>The string API is a default Lua 5.1 API. Please list any non-working functions below.<br />
<br />
List of non-working functions:<br />
<br />
[[Category:APIs]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=String&diff=200String2012-02-04T19:00:49Z<p>Onionnion: moved String to String (API)</p>
<hr />
<div>#REDIRECT [[String (API)]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Redstone_(API)&diff=197Redstone (API)2012-02-04T19:00:25Z<p>Onionnion: moved RS to Rs (API)</p>
<hr />
<div><br />
<br />
== Description ==<br />
<br />
The redstone API contains methods to control attached RedPower cables/bundled cables<br />
<br />
== Methods ==<br />
<br />
{| border="1" cellpadding="2" cellspacing="0"<br />
!style="background:#EEE" width="200px"|Method name<br />
!style="background:#EEE" width="*"|Description<br />
|-<br />
|[[Redstone_getBundledInput(side)|getBundledInput]]( side )<br />
|<br />
|-<br />
|[[Redstone_getBundledOutput|getBundledOutput]]( side )<br />
|returns the state of a redpower wire inside a bundle connected to ''side''<br />
|-<br />
|[[Redstone_setBundledOutput|setBundledOutput]]( side, colors )<br />
|Sets one or multiple colored signals in a redpower bundled wire connected to ''Side''<br />
|-<br />
|[[Redstone_testBundledInput|testBundledInput]]( side, color )<br />
|Returns true or false whether or not a colored signal is active in a redpower bundled wire connected to ''Side''<br />
|-<br />
|[[Redstone_getInput|getInput]]( side )<br />
|Returns the current redstone signal state on ''side''<br />
|-<br />
|[[Redstone_getSides|getSides]]()<br />
|Returns an array of possible sides<br />
|-<br />
|[[Redstone_setOutput|setOutput]]( side,boolean )<br />
|Set or reset a redstone signal on ''side'' <br />
|}<br />
<br />
<br />
[[Category:APIs]]</div>Onionnionhttp://www.computercraft.info/wiki/index.php?title=Rednet_(API)&diff=194Rednet (API)2012-02-04T18:59:15Z<p>Onionnion: moved REDNET to Rednet (API)</p>
<hr />
<div>The rednet API provides a simple computer networking model over RedPower bundled cables.<br />
{| border="1" cellpadding="2" cellspacing="0"<br />
!style="background:#EEE" width="200px"|Method name<br />
!style="background:#EEE" width="*"|Description<br />
|-<br />
|rednet.open( side )<br />
|Tells the computer that the side can be used for networking.<br />
|-<br />
|rednet.close( side )<br />
|Tells the computer that the side can no longer be used for networking.<br />
|-<br />
|rednet.announce()<br />
|<no description given><br />
|-<br />
|rednet.send( receiverID, message )<br />
|Sends a message to the computer using the opened sides.<br />
|-<br />
|rednet.broadcast( message )<br />
|Sends the message to ALL computers.<br />
|-<br />
|rednet.receive( timeout )<br />
|Receives packets. Usage: senderID, message = rednet.receive(5) and the like. It sends the ID of the sender, and the message.<br />
|}<br />
You can also handle the "rednet_message" event to receive messages without calling receive(), the arguments are the same as the receive() return values.<br />
[[Category:APIs]]</div>Onionnion