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


Recommended Posts

Posted

Just added a feature request. Any thoughts.

It occurred to me last night that if you added a new property to the virtual device "Shared LUA" that allowed entry of some text for LUA functions.

This string could then be concatenated with the code text of each button and main loop before loading the lua for each button into the lua engine.

Not true global functions as it would not be added to the environment table but it would reduce the cut and paste a bit.

Any chance of looking into this as a stepping stone to something better?

Please login or register to see this link.

Posted

This is a good suggestion. I hope and beleive that the rumored "plugin" system would add this functionality, otherwise it wouldn't be much of an improvement.

A separate "Shared LUA" part wouldn't even be needed if "global" vars/functions within a single virtual device was allowed. This would probably be very simple to implement and shouldn't introduce any security issues as far as I can tell.

An upside to a specified shared part would be that the shared code could be separated from buttons and main. As of today most advanced virtual devices needs either labels or buttons to keep and share "global" data (I try to avoid using global vars as long as I cannot create/destroy them from LUA without using the API). Such an approach would also result in much cleaner code for virtual devices and that is an important factor.

Programming a virtual device today is much about working around the, sometimes odd, restrictions of said devices.

+1

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