288 posts
Location
The trashcan where all Undertale trash is
Posted 04 September 2012 - 08:46 PM
How do you make an API? I.e have a bunch of functions that you could call with api.function()?
318 posts
Location
Somewhere on the planet called earth
Posted 04 September 2012 - 09:02 PM
lets say you made some function like this:
Save this as the file myApi
function sayHello(thing)
print("hello"..thing..")
end
function clearScreen()
term.clear()
term.setCursorPos(1, 1)
end
Save that and find the file. Outsides of mc, Make sure it has no extensions it is supposed to be a file file.
then goto minecraft/mods/computercraft/lua/rom/apis
Put the file in there and reboot CC pc.
now in anyfile you can do :
myApi.sayHello(sjele)
--or
myApi.clearScreen()
288 posts
Location
The trashcan where all Undertale trash is
Posted 05 September 2012 - 12:54 AM
Cool. Can you just use os.loadAPI with the file on the computer or a floppy?
318 posts
Location
Somewhere on the planet called earth
Posted 05 September 2012 - 06:36 AM
Yeh, i belive so. But if you have it in apis folder they auto load.