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

dev question.


Question

Posted

may I ask developer question? 

 

Well, that's a question that needs to be asked.... 

how (or "why I can't" if FIBARO dev can read this post) I can create global LUA function?

for example, I want to declare once

Please login or register to see this code.

 

and simple call from any scenes this function with own parameters.

 

yes, I can workaround :

1) create scene 

2) check fibaro:args()

3) pass from any scenes params... fibaro:startScene(sceneID, {'Yarr!', 'Value1', 'Value2', 'Value3'} );

but IMHO it's very clumsy handled

 

Please login or register to see this code.

it doesn't work!

 

2 answers to this question

Recommended Posts

  • 0
Posted

Long shot... Because scenes do not share a Lua environment. Each runs its own environment... fibaro:abort kills the runtime.

Next question: why is each scene separate... I don't know :-)

  • Thanks 1
  • 0
Posted

the lua interpreter runs as separate process for each every scene/vd/plugin. Btw, there might be a way to communicate between all of them (e.g. TCP), but it is overkill and does not guarantee smooth processing (as each every what so ever have to wait till data got received)

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