gopher-lua-libs icon indicating copy to clipboard operation
gopher-lua-libs copied to clipboard

Update plugin to work more like goroutines

Open scr-oath opened this issue 3 years ago • 0 comments

Add a few more features to plugin to make it work more like go routines:

  1. Ensure the go p.start is really started (with sync.Cond and started) - so we know that the struct is consistently started when calling methods on it
  2. Add the ability to pass simple args - those that don't rely on metatables such as string, number, channel and simple tables
  3. Add a doneCh which can be waited on by other plugin instances since a channel may be passed
  4. Add convenience wait that waits for doneCh and returns error
  5. Wrote a few unit test cases to show how to fire up plugins like goroutines, and communicate with channels.
  6. Solved the dependency loop by moving libs.Preload down to plugins and calling it from libs.Preload - so there's only one source of truth and each plugin has all the things loaded.
  7. Allow passing functions too as long as they aren't closures… allowing a plugin body like pcall(unpack(arg))

scr-oath avatar Aug 02 '22 06:08 scr-oath