Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


Question

Posted

I am doing something really silly, but cant find the answer.

 

Everytime I try to call a function I get some nil reference error, like for HTTPClient or getDeviceIds or anything. So some setup is wrong, but I cant find the answer. Even if I try to put “require” somewhere I get a nl reference error on that call ...

 

Pointers much appreciated.

2 answers to this question

Recommended Posts

  • 0
Posted
4 minutes ago, Relaxandbecool said:

I am doing something really silly, but cant find the answer.

 

Everytime I try to call a function I get some nil reference error, like for HTTPClient or getDeviceIds or anything. So some setup is wrong, but I cant find the answer. Even if I try to put “require” somewhere I get a nl reference error on that call ...

 

Pointers much appreciated.

The Lua we have on HC2/HC3 devices is limited - some standard Lua functions are removed. 'require' is such a function (in fact, if you call 'require' you would get an error, not nil)

net.HTTPClient():request(...) works with callbacks, so the function returns nil but it will call your provided 'success' and 'error' functions when it gets a result.

There are many discussions on this in the forum - try the search function.

  • 0
  • Inquirer
  • Posted

    Many thanks. Yes, I am trying to follow API documentation, sample code examples (for example from Tinman) and others, but every function that is called seems to produce some error message saying attempt to call a nil function or some such error. The API docs refers to require so its interesting to know that its not implemented. For a newbie trying to find accurate information it sure is hard .....

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...