Skip to content

lua engine improvements

Changes in this MR:

  1. It enables support for loading lua libraries, so you can now add a script that returns some object in scripts/lib/ and then use local object = require("that-script") to load it into the context of the current script. Additionally, loading arbitrary lua libraries from the standard lua path is allowed.

  2. It loosens up the sandbox, so that more functionality is allowed (See #121). Interacting with files or processes is still not allowed, even though you can now work this around by injecting a lua module written in C that provides the said functionality, but I would really prefer that people are "steered" to use wireplumber modules to do that and integrate I/O properly with the event loop instead.

  3. It wraps every script in a WpPlugin subclass and exposes API for the scripts to finish their activation asynchronously. That means that when the WpPlugin is enabled with wp_object_activate (p, WP_PLUGIN_FEATURE_ENABLED, ...) from main.c, the script has a chance to delay the activation of its "ENABLED" feature and initialize things asynchronously. This will be useful to implement the functionality discussed in !313.

Merge request reports