Index
____________________________________________________________________________________________________________________________________________________________________
- fLib - Extended file handling
- Ovar - Persistant variables
- Modifications
- Layout Modules/Classes
- Batch Interpreter - Write batch programs and run them
[anchor='flib']fLib - Extended file handling
fLib is an API, that makes file handling a breeze. Write, append, even replace lines in a file with one line of code.
This is a must have for file-based programs. Also, this API can be used both inside CC, and outside.
Functions
flib.exists(path) --Returns true if path exists, and is a file
flib.getTable(path) --Returns a table with all the lines
flib.getLine(path, n) --Returns the Nth line
flib.getText(path) --Returns all the text in the file
flib.fwrite(path, text) --Writes text in a file
flib.fappend(path, text) --Appends text to a file
flib.fwriteAtStart(path, text) --Writes text at the start of a file
flib.fwriteFromTable(path, table) --Writes each field in table as a line in the file
flib.fappendFromTable(path, table) --Appends to a file with each field in table as a line
flib.fwriteAtStartFromTable(path, table) --Writes at the start of a file with each field in table as a line
flib.fwriteFromLine(path, n, text) --Writes text from Nth line, and keeps everything beneath the Nth line
flib.fwriteFromLineFromTable(path, line, table) --Writes from Nth line with each field in table> as a line, and keeps everything beneath the Nth line
flib.replaceLine(path, line, text) --Replaces the Nth line in a file with text
flib.getName(path) --Returns the name of the file, without the path
flib.getPath(path) --Returns the path of the file, without the name
flib.fremove(path) --Removes a file
Usage
You use this API as any other API. Install it, and you will be able to use every function like this:
flib.function(args)
Installation
- Download the file
- Navigate to your .minecraftmodsComputerCraftluarom folder
- put the file in the apis folder
- Start Minecraft
- Handle some files!
Download
You can download the API here
[anchor='ovar']Ovar - Persistant variables
This API makes storing variables something anyone can do. Create new variables, change them as you wan't to, save them and load them. Very useful for login systems and/or e.g. game highscores. It is very easy to use, and doesn't require much skill to master.
Functions
ovar.new(name, value) --Creates a new variable, that can now be loaded
ovar.load(name) --Returns an old value, asuming that it exists
Usage
Example 1: Creating a variable, and printing the value
local x = ovar.new("test", 10) --We create a the variable
x:save() --We save the value, so it can be used later
print(x.value) --We print the value
x:unload() --We unload the variable
------------------------------------------------
Output:
10
Example 2: Changing the value(Using the variable from before)
local x = ovar.load("test")
x.value = {"Hello ", "World!"} --We set the value of x to a table
x:save()
print(x.value[1] .. x.value[2]) --We print the two fields in the table
------------------------------------------------
Output:
Hello World!
Programs using this API
Installation
- Download the file
- Navigate to your .minecraftmodsComputerCraftluarom folder
- Put the file in the apis folder
- Start Minecraft
- Make some variables!
Download
You can download the API here
[anchor='mods']Modifications
[anchor='modbios1']Modified BIOS - os.remove() and custom read()
This BIOS adds one function, and replaces another one. It adds os.remove(), and replaces read() with a function I made.
Installation:
- Download the file
- Navigate to your .minecraftmodsComputerCraftlua folder
- Put the file in there
- Start Minecraft
- Read some text!
Download
You can download the BIOS here
[anchor='layout']Layout Classes/Modules
[anchor='layouttextfield']Textfield - Create editable textfields
This class allows you to create textfield, that can be edited, you can set the value, get the value, and all sorts of stuff. Useful for making GUIs.
Functions
Textfield.new(name, x, y) --Creates a new textfield at (x, y), and returns it
Textfield:draw() --Draws the textfield on the screen
Textfield:setText(text) --Sets the value teh the instance to text
Textfield:edit() --Puts the cursor inside the textfield, and lets you edit the text
Textfield:setVisible(:)/>/> --Will the the visiblility to b
Textfield:getText() --Returns the value
Textfield:getMaxLenght() --Returns the max lenght allowed
Textfield:isVisible() --Returns true if the instance is visible
Textfield:setMaxLenght(lenght) --Sets the max lenght to lenght
]Textfield:setX(x) --Sets the instance's x position to x
Textfield:setY(y) --Sets the instance's y position to y
Textfield:getX() --Returns the instance's x position
Textfield:getY() --Returns the instance's y position
Usage
This class is very simple to use.
Example 1: Creating a textfield, setting the value and drawing it
local tf = Textfield.new("tf", 10, 2, 30) --We create the textfield
tf:setText("Hello World!") --We set the text
tf:draw() --We draw the textfield
Example 2: Editing the textfield, and drawing it(Using the textfield from before)
tf:edit() --We go in edit mode
tf:draw() --When the user is done editing, we draw the textfield
You get the point. It is very simple, and right on.
Installation
- Download the file
- Navigate to your .minecraftmodsComputerCraftluarom folder
- Put the file in the apis folder
- Start Minecraft
- Make some textfields!
Download
You can download the API here
[anchor='layoutbutton']Button - Create clickable buttons
Functions
Button.new(name, x, y width, height) --Creates a new button, and returns it
Button:draw() --Draws the instance
Button:setText(text) --Sets the instance's text to text
Button:setVisible(:D/>/> --Will set the instance's visibility to b
Button:getText() --Returns the instance's text
Button:getWidth() --Returns the instance's width
Button:getHeight() --Returns the instance's height
Button:setAction(f) --Sets the action to f (MUST BE A FUNCTION)
Button:onClick() --Performs the instance's action
Button:setX(x) --Sets the instance's x position to x
Button:setY(y) --Sets the instance's y position to y
Button:getX() --Returns the instance's x position
Button:getY() --Returns the instance's y position
Button:getAction() --Returns the action
Button:setWidth(width) --Sets the instance's width to width
Button:setHeight(height) --Sets the instance's height to height
Usage
This class is very simple to use.
Example 1: Creating a button, setting the action, setting the text and drawing it
local f = function() --We create the action
print("Hello World!")
end
local bu = Button.new("button1", 10, 2, 20, 5) --We make the button
bu:setAction(f) --We set the action
bu:setText("Click me!") --We set the text
bu:draw() --We draw the button
Example 2: Performing the action(Using the button from before)
bu:onClick()
Installation
- Download the file
- Navigate to your .minecraftmodsComputerCraftluarom folder
- put the file in the apis folder
- Start Minecraft
- Click some buttons!
Download
You can download the API here
[anchor='batch']Batch Interpreter - Write batch programs and run them
This is my current project, so I currently don't have anything to show. It's supposed to be done in about 3 weeks, maybe even after.
If you make any programs/APIs/utilities using some of this software, please post them in the comments! That would mean alot to me!
If you read just some of this, thank you alot. Please leave suggestions/requests/feedback in the comments!
-mad1231999