[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Object "Forwarding" Between States
- From: Oliver <oschmidt-mailinglists@...>
- Date: Wed, 29 Jun 2022 09:47:50 +0200
On 28.06.22 17:14, Scott Morgan wrote:
> I'm thinking about ways to share objects between states, something I've not
> needed to do before, and have come up with a possible technique:
> Q1 : Has anyone ever done this? (Is there already a lib)
you may want to have a look at "mtstates" for invoking Lua interpreter states
from multiple threads:
> A call in L2, e.g. `fwd:foo("test")`, picks up the name of the method, and it's
> arguments, than passes them into L1's state, calling the method on `obj`.
> Results are then returned to L2 as expected, with non-basic Lua types being
> wrapped in their own forwarding objects.
you could easily do this with pure Lua on top of the low level mtstates package,
see the examples at: https://github.com/osch/lua-mtstates#examples