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


  • 0

Hum, easy problem I think : Argument does not pass [SOLVED]


jwetzel
 Share

Question

Why ? Each calls the same function and the same argument

 

Please login or register to see this code.

 

thx for your help

Edited by jwetzel
update
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0
11 minutes ago, jwetzel said:

Why ? Each calls the same function and the same argument

 

Please login or register to see this code.

 

thx for your help

So Auth:login(fun) calls the fun eventually?

In the first case the variable 'boolean' is not passed to the function in self[self.model][object]

and in the second case it's passed to RTV1905VW:setWifi(boolean).

 

Is it so that the function in self[self.model][object] is a class method? Then you need to pass 'self' as first argument.

Link to comment
Share on other sites

  • 0
  • Inquirer
  • 11 minutes ago, jgab said:

    So Auth:login(fun) calls the fun eventually?

    In the first case the variable 'boolean' is not passed to the function in self[self.model][object]

    and in the second case it's passed to RTV1905VW:setWifi(boolean).

     

    Is it so that the function in self[self.model][object] is a class method? Then you need to pass 'self' as first argument.

     

    Yes, Auth:login(fun) call fun.

    In the first case, I call in my class with 

    Please login or register to see this code.

     

    it's for self[self.model][object], self.model is text variable for "RTV1905VW", object is the text variable for "setWifi".

    Call is : self.RTV1905VW:setWifi

     

    The difference between calls functions is first call with self.RTV1905VW = RTV1905VW:new(app)

    and other call is direct call function with RTV1905VW:setWifi().

     

    I don't know if I was understandable ^^

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Yes, I save boolean result in self and get in another class with self.class.boolean. That not sexy, but it work.

     

    thx

    Link to comment
    Share on other sites

    • 0
    14 hours ago, jwetzel said:

    Yes, I save boolean result in self and get in another class with self.class.boolean. That not sexy, but it work.

     

    thx

    Well, my thinking was that if it was a class method this would work

    Please login or register to see this code.

    - self[self.model] is an object. 

    - self[self.model][object] is a method of that object

    Because it's a class method you need to send self (the object instance of RTV1905VW)  as the first parameter and the self is self[self.model]

    More verbose:

    Please login or register to see this code.

     

    • Like 1
    Link to comment
    Share on other sites

    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.

     Share

    ×
    ×
    • Create New...