Title says it all.
How do you make an API on only 1 computer?
Started by Geforce Fan, Oct 29 2012 08:53 PM
8 replies to this topic
#1
Posted 29 October 2012 - 08:53 PM
#2
Posted 29 October 2012 - 09:09 PM
By only putting it on that computer? Use os.loadAPI() to load APIs that aren't in the API folder.
#4
Posted 29 October 2012 - 10:17 PM
I.E. Like this
EVERYTHING in the API must be a function or else when you load it or call from it, It will run it.
Spoiler
EVERYTHING in the API must be a function or else when you load it or call from it, It will run it.
#5
Posted 30 October 2012 - 02:24 AM
How do you CREATE the api to load.
#6
Posted 30 October 2012 - 02:25 AM
The post just before yours showed you how. It's a file full of functions.
#7
Posted 30 October 2012 - 02:33 AM
So just use the edit program
like "edit file" then do your API then to load it os.loadAPI("file") ;
?
like "edit file" then do your API then to load it os.loadAPI("file") ;
?
#8
Posted 30 October 2012 - 02:54 AM
Making an API is very simple if you can write a program you can write an API. The only difference is the API does not need to be code that runs, it just needs functions that you can call from another program and have them run.
If you're not sure what to do then either
A- look at an existing API, there are several in /rom/apis
B- Read the tutorial http://www.computerc...reating-an-api/
If you're not sure what to do then either
A- look at an existing API, there are several in /rom/apis
B- Read the tutorial http://www.computerc...reating-an-api/
#9
Posted 30 October 2012 - 09:32 AM
1. Go into rom/apis and create a file.
2. The file must ONLY contain functions like this:
4. To use a function:
If the API file name is func, to use them you would do this:
2. The file must ONLY contain functions like this:
function derp()
print("You called the derp function")
end
function readText(file)
if fs.exists(file) then
file = fs.open(file,"r")
text = file.readAll()
fs.close()
print(text)
else
print(file.." does not exists!")
end
3. If it is in the rom/api, you will not need to use os.loadAPI("filename") to load it. Only use that if it is in the ID folder of the computer.4. To use a function:
If the API file name is func, to use them you would do this:
func.derp()
func.readText("derp")
5. And that should be all!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











