OS API
|
|||||||||
Stops a Alarm.
The Alarm event will not be fired when the alarm triggers after calling this function. You can set a alarm with with os.setAlarm. |
|||||||||
Syntax | os.cancelAlarm(
|
||||||||
Returns | nil | ||||||||
Part of | CC:Tweaked (source) | ||||||||
API | os | ||||||||
|
|
|||||||||
Stops a timer.
The Timer event will not be fired when the timer finishes after calling this function. You can start a timer with os.startTimer. |
|||||||||
Syntax | os.cancelTimer(
|
||||||||
Returns | nil | ||||||||
Part of | CC:Tweaked (source) | ||||||||
API | os | ||||||||
|
|
|||||||||||
Returns the time since the Computer was booted in seconds. | |||||||||||
Syntax | os.clock() | ||||||||||
Returns | number | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | os | ||||||||||
|
|
|||||||||||
Returns the number of Days passed. It starts counting from 1.
There are 3 possible arguments: |
|||||||||||
Syntax | os.day(
|
||||||||||
Returns | number day | ||||||||||
Part of | CC:Tweaked | ||||||||||
API | OS | ||||||||||
|
|
|||||||||||
Returns the current Unix epoch or the in-game epoch in milliseconds. Valid arguments for source are "utc" , "local" , and "ingame" . |
|||||||||||
Syntax | os.epoch(
|
||||||||||
Returns | number | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | os | ||||||||||
|
|
|||||||||||
Returns a number representing the unique ID of the Computer. | |||||||||||
Syntax | os.getComputerID() | ||||||||||
Returns | number id | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | os | ||||||||||
|
|
|||||||||||
Returns a string representing the computer's label. | |||||||||||
Syntax | os.getComputerLabel() | ||||||||||
Returns | string label | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | os | ||||||||||
|
|
|||||||||||
This function is deprecated. Use of this function will pollute the global table, use require instead.
Globally loads a user created program as a table of functions, using the name of the file as the reference to put the table under. |
|||||||||||
Syntax | os.loadAPI(
|
||||||||||
Returns | boolean | ||||||||||
Part of | CC:Tweaked | ||||||||||
API | os | ||||||||||
|
|
|||||||||
Under OS execution, takes argument filter and waits for the current process to be resumed with a vararg list where the first element matches filter. Under sandboxed execution, returns {...} to the application that has resumed the process. Unlike os.pullEventRaw, it will stop the application upon a "terminate" event. | |||||||||
Syntax | os.pullEvent(
|
||||||||
Returns | {...} | ||||||||
Part of | CC:Tweaked | ||||||||
API | os | ||||||||
See also | coroutine.yield | ||||||||
|
|
|||||||||
Duplicate of coroutine.yield. Under OS execution, takes argument filter and waits for the current process to be resumed with a vararg list where the first element matches filter. Under sandboxed execution, returns {...} to the application that has resumed the process. Unlike os.pullEvent, it does not stop the application upon a "terminate" event | |||||||||
Syntax | os.pullEventRaw(
|
||||||||
Returns | {...} | ||||||||
Part of | CC:Tweaked | ||||||||
API | os | ||||||||
See also | coroutine.yield | ||||||||
| |||||||||
|
|
|||||||||
Queues a Event | |||||||||
Syntax | os.queueEvent(
|
||||||||
Returns | nil | ||||||||
Part of | CC:Tweaked (source) | ||||||||
API | os | ||||||||
|
|
|||
Reboots the executing machine immediately. | |||
Syntax | os.reboot() | ||
Returns | nil | ||
Part of | CC:Tweaked (source) | ||
API | os |
|
|||||||||
Run a program at the path. | |||||||||
Syntax | os.run(
|
||||||||
Returns | nil | ||||||||
Part of | CC:Tweaked (source) | ||||||||
API | os | ||||||||
|
|
|||
Sets an Alarm, which will queue an Alarm Event at the specified time. The returned ID can be used to distinguish the Alarm from others. | |||
Syntax | os.setAlarm(
|
||
Returns | number alarmID | ||
API | os |
|
|||||||||||
Sets the computer's label to the passed string or to nothing if nil or an empty string was passed. | |||||||||||
Syntax | os.setComputerLabel(
|
||||||||||
Returns | nil | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | os | ||||||||||
|
|
|||
Shuts the executing machine down immediately. | |||
Syntax | os.shutdown() | ||
Returns | nil | ||
Part of | CC:Tweaked (source) | ||
API | os |
|
|||||||||||
Pauses execution of the program for time seconds. As it waits for a fixed amount of ticks, time will automatically be rounded up to the nearest multiple of 0.05 seconds. If you are using coroutines or the parallel API, it will only pause execution of the current thread, not the whole program.
|
|||||||||||
Syntax | sleep(
|
||||||||||
Returns | nil | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | BIOS globals | ||||||||||
| |||||||||||
|
|
|||||||||
Starts a Timer.
The Timer event is fired when the timer is finished. You can stop the timer with os.cancelTimer. |
|||||||||
Syntax | os.startTimer(
|
||||||||
Returns | number timerID | ||||||||
Part of | CC:Tweaked (source) | ||||||||
API | os | ||||||||
|
|
|||||||||||
Returns the current real or inagme time. Valid arguments for source are "utc" , "local" , and "ingame" . |
|||||||||||
Syntax | os.time(
|
||||||||||
Returns | number | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | os | ||||||||||
|
|
|||||||||
This function is deprecated. Use of this function will pollute the global table, use require instead.
Unloads a API which was loaded by os.loadAPI. |
|||||||||
Syntax | os.unloadAPI(
|
||||||||
Returns | nil | ||||||||
Part of | CC:Tweaked (source) | ||||||||
API | os | ||||||||
|
|
|||||||||||
Returns a string representing the name and version of CraftOS. | |||||||||||
Syntax | os.version() | ||||||||||
Returns | string | ||||||||||
Part of | CC:Tweaked (source) | ||||||||||
API | os | ||||||||||
|
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.