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

Maximum length of the content of a variable?


Guest FredrikKarlsson

Question

Guest FredrikKarlsson

Hi,

 

Does anyone know what the maximim length may be of the content that you store in a variable may be? 

For instance, can a HomeTable structure break your box if it is too big?

 

Thank you,

 

Fredrik

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0
1 hour ago, FredrikKarlsson said:

Hi,

 

Does anyone know what the maximim length may be of the content that you store in a variable may be? 

For instance, can a HomeTable structure break your box if it is too big?

 

Thank you,

 

Fredrik

 

Hi @FredrikKarlsson

I seem to recall reading the max size for a global is about 28k characters and if you exceed this the table will get corrupt

Are you reaching close to this size

 

 

Link to comment
Share on other sites

  • 0
Guest FredrikKarlsson
  • Inquirer
  • 2 hours ago, AutoFrank said:

     

    Hi @FredrikKarlsson

    I seem to recall reading the max size for a global is about 28k characters and if you exceed this the table will get corrupt

    Are you reaching close to this size

     

    Hi,

     

    No, I just used the HomeTable as an example. I had an idea of a creative use of variables for storing library code, but I soon discovered that the Lua implementation in Fibaro, like always, is strongly impaired.

     

    This works in a Lua console on my computer

    Please login or register to see this code.

     

    but this equivalent code

    Please login or register to see this code.

    raises an error :

     

     

    Quote

    [DEBUG] 11:43:01: line 9: attempt to call global 'loadstring' (a nil value)

     

    I do wish Fibaro would not treat their Lua capability as the thing they never wanted in the first place. How about telling us something about what is available??

     

    Fredrik

     

     

    Link to comment
    Share on other sites

    • 0

    I'm not 100% sure but my guess is that Fibaro sets up a Lua "sandbox" with a stripped down environment (removed Lua functions etc) before calling the user's code.

    'loadstring' is a bit "unsafe" as it runs in the global environment bypassing the sandbox which would give user's access to os.execute, io.read/write etc...

     

    Link to comment
    Share on other sites

    • 0
    Guest FredrikKarlsson
  • Inquirer
  • 12 minutes ago, jgab said:

    I'm not 100% sure but my guess is that Fibaro sets up a Lua "sandbox" with a stripped down environment (removed Lua functions etc) before calling the user's code.

    'loadstring' is a bit "unsafe" as it runs in the global environment bypassing the sandbox which would give user's access to os.execute, io.read/write etc...

     

     

    Yes, sure - there are functions that have been excluded, and maybe for good reason. But how come I cannot be told about which functions are actually included? 

     

    Frustrating..

     

    Link to comment
    Share on other sites

    • 0

    Scenes have everything Lua has, except this list of disabled functions (and tables).

     

    EDIT: official list is now here:

     

    Edited by petergebruers
    Link to comment
    Share on other sites

    • 0
    On 27/10/2017 at 1:19 AM, FredrikKarlsson said:

    Hi,

     

    Does anyone know what the maximim length may be of the content that you store in a variable may be? 

    For instance, can a HomeTable structure break your box if it is too big?

     

    Thank you,

     

    Fredrik

     

    Hi @FredrikKarlsson,

     

    please see this thread on some LUA limitations:

     

    Link to comment
    Share on other sites

    • 0
    10 hours ago, I.Srodka said:

    @FredrikKarlsson,

     

    This article was made for you ; )

     

    PS @Sankotronic, you may also find it useful.

     

    The functions on the list makes sense to block but I think it would be possible to allow for 'coroutine' in a safe way. Would allow for some cool wrappers around the asynchronous calls (HTTP, setTimeout etc) to make them 'easier' to use... and some new paradigms for coding schedulers...

    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.

    ×
    ×
    • Create New...