I am building a theme park in Tekkit, and I want to make it so the ticket is made so that the computer check the label. I know what the disk API is, but how do I use it?
Disk API
Started by ebernerd, Feb 08 2013 11:49 AM
3 replies to this topic
#1
Posted 08 February 2013 - 11:49 AM
#2
Posted 08 February 2013 - 11:53 AM
Knowing what it is would include knowing how to use it. In this particular case you want to use disk.getLabel() somehow.
#3
Posted 08 February 2013 - 12:01 PM
What do you mean by how to use it?
OK. In a nutshell...
When you insert a disk, CC mounts it. YOu can reach its data in disk/ directory, or disk2/ if that's the second mounted disk, or disk3/, etc.
So opening a file from a disk is like
When you have only one disk drive, that's easy like that. But what's up with multiple disk drives?
You can get the path ("disk" or "disk2" etc.) using
EDIT: Sorry, I misunderstood - I thought you haven't ever used disk API.
OK. In a nutshell...
When you insert a disk, CC mounts it. YOu can reach its data in disk/ directory, or disk2/ if that's the second mounted disk, or disk3/, etc.
So opening a file from a disk is like
local handle = fs.open("disk/myfile", "r")
When you have only one disk drive, that's easy like that. But what's up with multiple disk drives?
You can get the path ("disk" or "disk2" etc.) using
disk.getMountPath(side)where side is the side where the disk drive you want to use is.
EDIT: Sorry, I misunderstood - I thought you haven't ever used disk API.
#4
Posted 08 February 2013 - 12:36 PM
LBPHacker, on 08 February 2013 - 12:01 PM, said:
What do you mean by how to use it?
OK. In a nutshell...
When you insert a disk, CC mounts it. YOu can reach its data in disk/ directory, or disk2/ if that's the second mounted disk, or disk3/, etc.
So opening a file from a disk is like
When you have only one disk drive, that's easy like that. But what's up with multiple disk drives?
You can get the path ("disk" or "disk2" etc.) using
EDIT: Sorry, I misunderstood - I thought you haven't ever used disk API.
OK. In a nutshell...
When you insert a disk, CC mounts it. YOu can reach its data in disk/ directory, or disk2/ if that's the second mounted disk, or disk3/, etc.
So opening a file from a disk is like
local handle = fs.open("disk/myfile", "r")
When you have only one disk drive, that's easy like that. But what's up with multiple disk drives?
You can get the path ("disk" or "disk2" etc.) using
disk.getMountPath(side)where side is the side where the disk drive you want to use is.
EDIT: Sorry, I misunderstood - I thought you haven't ever used disk API.
I want it to automatically check for the label.
So, can you get this to work:
if disk.getLabel("top") == "SFTTicket" then
blah blah blah code
end
Idk how to get it to work. It always says "returned nil"
EDIT: GOT IT! THE ERROR WAS WHERE I PUT BLAH BLAH BLAH CODE
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











