Each time I try to use a function in the API I made , it tells me : No such programs.
Here's my code:
os.loadAPI("exampleAPI")
-- this is the file exampleAPI
-- our first function
function printMessage(message)
print(message)
end
____________
And here's how I try to use my function:
exampleAPI.printMessage("anymessage")
____________
This is a code I got from the computercraft.info tutorial section.
Question about loading APIs
Started by mantricore, Apr 20 2013 07:45 AM
3 replies to this topic
#1
Posted 20 April 2013 - 07:45 AM
#2
Posted 20 April 2013 - 07:58 AM
Split into new topic.
You need to load the API from the file you want to use it in, not the API itself. Can you link to the tutorial so we can fix it if necessary?
You need to load the API from the file you want to use it in, not the API itself. Can you link to the tutorial so we can fix it if necessary?
#3
Posted 20 April 2013 - 08:18 AM
http://computercraft..._API_(tutorial)
Here it is
I am not sure to really understand what you tell me to do...
Could you please give me an example ?
Here it is
I am not sure to really understand what you tell me to do...
Could you please give me an example ?
#4
Posted 20 April 2013 - 10:12 AM
The os.loadAPI line needs to be at the top of the file that calls the API function, not the file that declares the API function.
os.loadAPI("example")
example.doStuff()
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











