Difference between revisions of "OS (API)"

From ComputerCraft Wiki
Jump to: navigation, search
(Fixed misknowledge.)
Line 2: Line 2:
  
 
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.
The functions of this API are:
+
{| border="1" cellpadding="2" cellspacing="0"
*os.version() which returns the version
+
!style="background:#EEE" width="200px"|Method name
*os.computerID() which returns the computerID
+
!style="background:#EEE" width="*"|Description
*os.run( environment, programpath, arguments)
+
|-
*os.loadAPI( name ) which loads an API
+
|os.version()
*os.unloadAPI( name ) which does the opposite
+
|Returns version
*os.pullEvent()
+
|-
*os.queueEvent()
+
|os.computerID()
*os.clock() returns the CPU time.
+
|Returns the ID of the computer
*os.startTimer( timeout )
+
|-
*os.sleep( timeout ) makes the system wait a bit before doing something. Helpful with fake loading.
+
|os.run( environment, programpath, arguments )
*os.time() returns the MineCraft time.
+
|<no description given>
*os.setAlarm( time )
+
|-
*os.shutdown() which is exactly what is said on the tin.
+
|
*os.reboot() which does what it says.
+
|-
 +
|parallel.waitForAll( function1, function2, so on)
 +
|Waits for all of the functions to complete.
 +
|-
 +
|os.loadAPI( name )
 +
|Loads the API given.
 +
|-
 +
|os.unloadAPI( name )
 +
|Unloads it.
 +
|-
 +
|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.
 +
|}
 
[[Category:APIs]]
 
[[Category:APIs]]

Revision as of 05:46, 31 January 2012

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

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>
parallel.waitForAll( function1, function2, so on) Waits for all of the functions to complete.
os.loadAPI( name ) Loads the API given.
os.unloadAPI( name ) Unloads it.
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.