lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi Sean,


On 29/06/2017 23:51, Sean Conner wrote:
It was thus said that the Great Laurent FAILLIE once stated:

Wrong file---the code is in selene.c (and similar in SelMQTT.c).  But the
one thing that *really* stands out is this:

    lua_xmove( L, tstate, 1 );

   You might want to double check the documentation for lua_xmove() because
it's not doing what you think it's doing.  I'm not sure that's what's
causing the issue you are seeing, but it's probably causing *some* issue.
It's here to push the function from the main state to the slave one as per lua_pcall()'s documentation.
It is here to push the Lua function to "launch" into the slave's state, from lua_*call() functions documentation.
In Selene.c, the function is Detach() first and only argument.
In SelMQTT.c, the function is retrieved from LUA_REGISTRY.

I don't think there is any trouble here as my home's dashboard is running for months on 24/7 basis and this part of code is called on several MQTT message arrivals which happening several time per hours (most of message handling is done using another mechanism as dealing with graphics so not suitable to be done asynchronously).
The same code is used on the automation tools as well which drives shutters and other things.

Both of them have months of uptime without trouble so I guess they are stable.

But back to my issue : for me, it's a bit illogical to get a metatable but not being able to call it's "member". Perhaps I missed something when initialing the slave's state ... but can't find what. And all other stuffs are working find fine in slave ...
I think I would have to jump into Lua's own code to understand what's happening ...

Thanks

Laurent