Hello,
I am trying to make an 'About Computer' section, and I need to get some information like the ComputerCraft Version... here is a list:
- Minecraft Version
- ComputerCraft Version
- Computer Number
- Computer Label
- Computer Maximum Space
- Computer Space remaining
I have been looking around on the forums, and have been unable to find anything!
0
2 replies to this topic
#1
Posted 07 October 2017 - 10:10 AM
#2
Posted 08 October 2017 - 09:03 AM
Minecraft and ComputerCraft version are stored in the _HOST variable (assuming you're on ComputerCraft 1.76 or greater). These can be extracted with Lua patterns:
Computer number (or id) and label can be accessed through the os API.
The space remaining can be accessed through fs.getFreeSpace("/"). There isn't a built in way to get the storage capacity of a computer, but you can find the size of each file on disk and add them to the free space to get the capacity.
local cc_version = _HOST:match("ComputerCraft (%S+)") local mc_version = _HOST:match("Minecraft (%S+)")
Computer number (or id) and label can be accessed through the os API.
The space remaining can be accessed through fs.getFreeSpace("/"). There isn't a built in way to get the storage capacity of a computer, but you can find the size of each file on disk and add them to the free space to get the capacity.
#3
Posted 08 October 2017 - 10:47 PM
Also keep in mind that if you are running an emulator you will instead get the emulator's version instead of Minecraft's.
I believe fs.getFreeSpace(...) returns a number in bytes?
I believe fs.getFreeSpace(...) returns a number in bytes?
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users