lua-users home
lua-l archive

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


Please describe more what you mean by L1, L2.

If these are states in your C source code, and you use multithreading
approach for Lua (using yield/resume), then typically you can quite
easily exchange info between the different threads through global
data... .

If you use C states for different Lua source files, then I think you
should best define some C helper functions in form of a small library,
which the user then can invoke from Lua to exchange data in a defined
way.

(but no experience with this second approach ... currently I for my
Lua applications I use one Lua file and possibly different states for
different threads... so global data in Lua file is then fine, the Lua
users can do this themselves then ...).

On Tue, Jun 28, 2022 at 5:15 PM Scott Morgan <blumf@blueyonder.co.uk> 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:
>
> State L1 has the actual object `obj`
> State L2 is given a 'forwarding' object `fwd`
> Scott