Jump to content




os.loadApi: attempt to call nil


  • You cannot reply to this topic
2 replies to this topic

#1 ascobol

  • New Members
  • 2 posts

Posted 27 February 2014 - 08:06 AM

Hello there,

I hope anyone can help me.

I tried to write a small farming program for a turtle and wanted to put some functions, that I maybe could use in the future or for other programs as well, in an api.

Unfortunately, everytime I try to load the api via os.loadapi(), I get the error "attempt to call nil"

I tried to load the api in my script and as well on the lua prompt directly. Both give the same result.

I have three scripts: The download works ok.
After that I start the program ("farming"). And get the error "farming:17: attempt to call nil".
If I try to load the api directly on the lua prompt, I get "lua:52: attempt to call nil".

Anyone an idea what I do wrong?

I read some posts here on the forum already and tried some solutions (on other problems) already.
For example, use a absolute path, like "/farmingApi", I tried another name for the api or to put in a sub-folder instead of root.

But it didn't help.

I even tried it with a simple testApi, like
function sayHello()
   print("Hello there!")
end

Even that gets the same error when I try to load it.

I use ComputerCraft 1.53 (FTB Unleashed).

Thanks in advance
Ascobol

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 27 February 2014 - 03:57 PM

Line 17 in the linked code is a comment. Can you post the actual code?

#3 ascobol

  • New Members
  • 2 posts

Posted 27 February 2014 - 04:49 PM

View PostLyqyd, on 27 February 2014 - 03:57 PM, said:

Line 17 in the linked code is a comment. Can you post the actual code?
Hi Lyqyd,

thanks for the reply.
Yes, I found the error already. But I couldn't take the post back. I couldn't find it anywhere till was approved. Sorry for the inconvience.

My error the function typing:

I used: os.loadApi(...)

But it must be os.loadAPI(...)

Found that out after I read every faq and tutorial twice again. Unfortunately, as said, I couldn't delete the post then or mark it as solved.

But thanks for the reply.

Ascobol

PS: I read the faqs and tutorials before several times too, but somehow oversaw the capitlized API. Sorry.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users