Sharing global variables between extension script and interface script
Posted: 20 Jun 2021 13:57
Hi! I need to share a table between my extension script located in lua/extensions and my interface script located in lua/intf.
Currently I'm using the ingenious method used in time v3.2 (writing the table to a files, and reading it on the other side), But repetitive IO operations are bad.
I've read online that lua has a global table _G shared between scripts, but whatever reason _G in the extension and _G in the interface are two separate tables.
interface:
extension:
in the extension _G.temp evaluates to nil and crashes it, why?
as an alternative is it possible to signal the interface from the extension whenever it updates the file? using https://luaposix.github.io/luaposix/mod ... ignal.html library maybe?
Thank you
Currently I'm using the ingenious method used in time v3.2 (writing the table to a files, and reading it on the other side), But repetitive IO operations are bad.
I've read online that lua has a global table _G shared between scripts, but whatever reason _G in the extension and _G in the interface are two separate tables.
interface:
Code: Select all
_G.temp = "message"
Code: Select all
function activate()
vlc.msg.info(_G.temp)
end
as an alternative is it possible to signal the interface from the extension whenever it updates the file? using https://luaposix.github.io/luaposix/mod ... ignal.html library maybe?
Thank you