This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
FoxData's profile picture

A Guide on loading custom API's

Started by FoxData, 20 July 2016 - 06:59 PM
FoxData #1
Posted 20 July 2016 - 08:59 PM
This tutorial is mean for beginners only!!!

Starting off
An API is a set of functions to make your programming easier.

An Example: If you want to make a rednet spamming program when you would need to write all the rednet stuff. But with an API installed. You can do all that in a single line

Getting one
Obtaining an API is simple. Just download one from this very forum. Use the pastebin download and once you have the API move on the to next step.

Loading it
Make a startup file with the code
os.loadAPI("<API NAME HERE>")

Using it
Create another file with a different name and type in the code for that API into it and run it.

A small tip
If a program that you have made requires an API please tell the people here about it. We don't want the best program ever to error because we missed out a tiny little API?
And make sure to credit the creator of the API (Not doing it could result in legal issues)

PS: Another way to test an API is to use the LUA console
Edited on 23 July 2016 - 03:54 PM
Exerro #2
Posted 21 July 2016 - 10:28 AM
You didn't mention that functions and variables have to be global when defined in the API. If you localise them, they won't be visible in the API table.
Luca_S #3
Posted 21 July 2016 - 11:41 AM
Also you should remove the quotation marks around os.loadAPI() and instead use a code block also you should fix your number of quotation marks.
Saldor010 #4
Posted 22 July 2016 - 04:13 AM
This is a very low content, low quality tutorial (no offense meant). You should try to expand the topic, perhaps to encompass everything about API's, instead of just one little niche. Or at the least you could add more detail to the content you already have.
FoxData #5
Posted 23 July 2016 - 05:54 PM
You still didn't fix the quotes. Jiloacom is right this tutorial is completely useless it can be looked up on the wiki.
Fixed!
Marcell D'avis #6
Posted 25 July 2016 - 02:43 PM
This tutorial really helped me, thanks! But how do I create my own API?
KingofGamesYami #7
Posted 25 July 2016 - 06:24 PM
This tutorial really helped me, thanks! But how do I create my own API?

There's a tutorial on the wiki covering that topic.