2 posts
Location
Dallas, OR
Posted 09 January 2013 - 06:37 PM
I'm trying to load an API located in a subdirectory (I have to have it in a subdirectory, as I'm loading it from a cc-get repo.)
However, I can't seem to get it to load.
I've tried stuff like os.loadAPI("/bin/foldername/apiname")
and os.loadAPI("bin/foldername/apiname")
But I can't seem to get it to work, some ways, It can load the API without an error, but when I try to use apiname.apifunction("derpparams") i get the following error:
For input string: "apiname"
…Which makes no sense to me…
Any idea what I'm doing wrong?
2088 posts
Location
South Africa
Posted 10 January 2013 - 12:22 AM
Works fine for me.
Within the computer, i had a folder 'mainFolder' and within there i had another folder called 'apis' and within there I had an api called 'myAPI'
os.unloadAPI("mainFolder/apis/myAPI") -- Try adding this? Although, I removed it and it still worked fine.
os.loadAPI("mainFolder/apis/myAPI")
myAPI.test("lol")
the api:
function test(text)
print(text)
end
it printed "lol" fine with no error.
Otherwise, try moving it to the main folder and then loading it and then moving it back?
fs.move("mainFolder/apis/myAPI", "myAPI")
os.unloadAPI("myAPI")
os.loadAPI("myAPI")
fs.move("myAPI", "mainFolder/apis/myAPI")
myAPI.test("lol")
2 posts
Location
Dallas, OR
Posted 10 January 2013 - 06:19 AM
Works fine for me.
Within the computer, i had a folder 'mainFolder' and within there i had another folder called 'apis' and within there I had an api called 'myAPI'
it printed "lol" fine with no error.
Otherwise, try moving it to the main folder and then loading it and then moving it back?
I'm not at a computer where I can test really, but now that I think of it, that could very easily be the problem.
I forgot that API's are loaded onto the entire computer, not just the program that I wish to run, and had the os.loadAPI() in it.
I beleive I had already loaded an api with the same name earlier from a different folder (testing stuffs) so that could have very easily been conflicting.
Doing as you said (below) will hopefully remedy the problem.
os.unloadAPI("mainFolder/apis/myAPI") -- Try adding this? Although, I removed it and it still worked fine.
os.loadAPI("mainFolder/apis/myAPI")
myAPI.test("lol")
Thanks, by the way.