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


Length of string


Lode

Recommended Posts

Hi,

 

I "stole" a piece of code from @jgab and i'm trying to make a label where you can put in a timevalue like "12:50"

So far so good.

I need to determine the length of a string but that doesn't seem to work.

When i debug "lengte" i get a nil value.

 

Please login or register to see this code.

 

Edited by Lode
Link to comment
Share on other sites

  • Lode changed the title to Length of string

Your fibaro.debug is  the problem - it needs a  tag as the first argument. 

fibaro.debug(__TAG,lengte)

Now it takes your length argument as the tag and it will not show....

__TAG is usually bound to  "QUICKAPP"..self.id

 

Because you are passing self to add you can also use the QuickApp  method debug that doesn't use a tag.

 

self:debug(lengte)

 

If you do a lot of   coding I would recommend that you use my offline HC3 emulator where you can debug the code properly on your PC/Mac

 

 

 

Edited by jgab
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • Topic Author
  • Thank you so much for helping me out again @jgab

    I really appreciate this.

     

    Link to comment
    Share on other sites

    Another tip.

    When you exit the QuickApp:onInit() function , the global lua variable 'quickApp' is  assigned the QuickApp object (aka 'self')

    This means that you can do

     

    Please login or register to see this code.

     

    The only reason to pass  around self is if you have a lot of QuickApp objects (ex. if you have QuickAppChild objects).

    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
    Reply to this topic...

    ×   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...