-
Notifications
You must be signed in to change notification settings - Fork 6
/
disk.lua
131 lines (119 loc) ยท 5.47 KB
/
disk.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
---@meta
---Functions for interacting with disk drives
---
---The disk functions can be used on a locally attached or remote disk drive
---peripheral. If the drive is attached locally, you can use the side it is
---attached to, if it is remote, you have to use the name printed when enabling
---its modem (e.g. `drive_0`).
---
---๐ฌ A disk drive can contain a floppy disk ๐พ, record ๐ฟ, or a computer ๐ฅ๏ธ
---(including pocket computer or turtle)
---
---๐ฌ Computers, turtles, and pocket computers can be placed in a disk drive to
---access their internal drives.
---
------
---[Official Documentation](https://tweaked.cc/module/disk.html)
disk = {}
---Checks that an item is in a disk drive
---@param name ccTweaked.peripheral.computerSide|string The name of the disk drive or the side of the computer that the drive is on
---@return boolean present
---Supports: ๐พ๐ฟ๐ฅ๏ธ
---## Example
---```
---disk.isPresent("top")
---disk.isPresent("drive_3")
---```
------
---[Official Documentation](https://tweaked.cc/module/disk.html#v:isPresent)
function disk.isPresent(name) end
---Get the label of the inserted item. If the inserted item is a computer,
---this returns the label of the computer as read by `os.getComputerLabel()`
---@param name ccTweaked.peripheral.computerSide|string The name of the disk drive or the side of the computer that the drive is on
---Supports: ๐พ๐ฟ๐ฅ๏ธ
---
------
---[Official Documentation](https://tweaked.cc/module/disk.html#v:getLabel)
function disk.getLabel(name) end
---Set the label of an inserted item.
---@param name ccTweaked.peripheral.computerSide|string The name of the disk drive or the side of the computer that the drive is on
---@param label string The new value for the label
---Supports: ๐พ๐ฟ๐ฅ๏ธ
---
------
---[Official Documentation](https://tweaked.cc/module/disk.html#v:setLabel)
function disk.setLabel(name, label) end
---Check if an item is present and provides a mount. For records, returns false
---@param name ccTweaked.peripheral.computerSide|string The name of the disk drive or the side of the computer that the drive is on
---@return boolean hasMount
---Supports: ๐พ๐ฟ๐ฅ๏ธ
---
------
---[Official Documentation](https://tweaked.cc/module/disk.html#v:hasData)
function disk.hasData(name) end
---Gets the path on this computer where the contents of the inserted item can be
---found
---@param name ccTweaked.peripheral.computerSide|string The name of the disk drive or the side of the computer that the drive is on
---@return ccTweaked.fs.path|nil path The path to the mount location or `nil` if the drive is empty or the inserted item cannot be mounted
---Supports: ๐พ๐ฟ๐ฅ๏ธ
---## Example
---```
---disk.getMountPath("left")
----->"/disk0"
---```
------
---[Official Documentation](https://tweaked.cc/module/disk.html#v:getMountPath)
function disk.getMountPath(name) end
---Checks that the inserted item is a music disk
---@param name ccTweaked.peripheral.computerSide|string The name of the disk drive or the side of the computer that the drive is on
---@return boolean hasAudio If an item is present and is a record
---Supports: ๐พ๐ฟ๐ฅ๏ธ
---
------
---[Official Documentation](https://tweaked.cc/module/disk.html#v:hasAudio)
function disk.hasAudio(name) end
---Get the title of the music track from the record in the drive. This usually
---results in the same as `disk.getLabel()` for records.
---@param name ccTweaked.peripheral.computerSide|string The name of the disk drive or the side of the computer that the drive is on
---@return string|false|nil title The track title, false if the inserted item is not a record, nil if there is no item in the drive
---Supports: ๐พ๐ฟ๐ฅ๏ธ
---
------
---[Official Documentation](https://tweaked.cc/module/disk.html#v:getAudioTitle)
function disk.getAudioTitle(name) end
---Plays the record in the drive
---
---Make sure to check that there is an item in the drive and that it is a record with `disk.hasData()`
---
---Stops any already playing records. The record will stop playing when it
---reaches the end of its runtime, is removed from the drive, or when stopped
---manually by `disk.stopAudio()`
---@param name ccTweaked.peripheral.computerSide|string The name of the disk drive or the side of the computer that the drive is on
---Supports: ๐ฟ
---
------
---[Official Documentation](https://tweaked.cc/module/disk.html#v:playAudio)
function disk.playAudio(name) end
---Stops the currently playing record that was started with `disk.playAudio()`
---@param name ccTweaked.peripheral.computerSide|string? The name of the disk drive or the side of the computer that the drive is on
---Supports: ๐ฟ
---
------
---[Official Documentation](https://tweaked.cc/module/disk.html#v:stopAudio)
function disk.stopAudio(name) end
---Ejects any item that is in the drive, dropping it into the world
---@param name ccTweaked.peripheral.computerSide|string The name of the disk drive or the side of the computer that the drive is on
---Supports: ๐พ๐ฟ๐ฅ๏ธ
---
------
---[Official Documentation](https://tweaked.cc/module/disk.html#v:eject)
function disk.eject(name) end
---Get the unique identifier of the disk in the drive. Only floppy disks have an
---ID
---@param name ccTweaked.peripheral.computerSide|string The name of the disk drive or the side of the computer that the drive is on
---@return number|nil ID The ID of the floppy disk or nil if the drive is empty or does not contain a floppy disk
---Supports: ๐พ
---
------
---[Official Documentation](https://tweaked.cc/module/disk.html#v:getID)
function disk.getID(name) end