Difference between revisions of "OS (API)"

From ComputerCraft Wiki
Jump to: navigation, search
m
Line 1: Line 1:
''You may be looking for alternative OSes for ComputerCraft. If so, go to the list of OSes.''
+
''You may be looking for alternative OS's for ComputerCraft. If so, go to the [[list of OS's]].''
  
 
The Operating System API allows for interfacing with the Lua based Operating System itself.
 
The Operating System API allows for interfacing with the Lua based Operating System itself.
Line 19: Line 19:
 
|-
 
|-
 
|os.unloadAPI( name )
 
|os.unloadAPI( name )
|Unloads it.
+
|Unloads the API given.
 
|-
 
|-
|[[PullEvent|os.pullEvent()]]
+
|[[#pullEvent|os.pullEvent()]]
 
|<no description given>
 
|<no description given>
 
|-
 
|-
Line 48: Line 48:
 
|Reboots the computer.
 
|Reboots the computer.
 
|}
 
|}
 +
 +
== <div id="pullEvent">os.pullEvent()</div> ==
 +
 +
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.
 +
 
[[Category:APIs]]
 
[[Category:APIs]]

Revision as of 05:09, 5 February 2012

You may be looking for alternative OS's for ComputerCraft. If so, go to the list of OS's.

The Operating System API allows for interfacing with the Lua based Operating System itself.

Method name Description
os.version() Returns version
os.computerID() Returns the ID of the computer
os.run( environment, programpath, arguments ) <no description given>
os.loadAPI( name ) Loads the API given.
os.unloadAPI( name ) Unloads the API given.
os.pullEvent() <no description given>
os.queueEvent() <no description given>
os.clock() Returns CPU time.
os.startTimer( timeout ) <no description given>
os.sleep( timeout ) Makes the system wait before continuing in the program.
os.time() Returns MineCraft time.
os.setAlarm( time ) <no description given>
os.shutdown() Turns off the computer.
os.reboot() Reboots the computer.

os.pullEvent()

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.