You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there any way to use _ENV with Lupa? From my testing I've gathered that each call to either .execute or .eval resets/uses its own _ENV, so if you set it in one call it resets by the next.
The Lua code outputs 1 then nil (like on this compiler), but using Lupa results in 1 and 1.
Context
I'm using Lupa to embed Lua into a UI library I'm making. Each widget has its own script, and their _ENV-s create a sort of cascade where each widget within a container has access to things defined above it, but not to its siblings. The end goal is something like Alpine.js.
I suspect the same cascade would be possible using functions instead of inline do ... end scopes, but that massively complicates everything.
Cheers, and enjoy the holidays!
The text was updated successfully, but these errors were encountered:
Is there any way to use
_ENV
with Lupa? From my testing I've gathered that each call to either.execute
or.eval
resets/uses its own_ENV
, so if you set it in one call it resets by the next.Reproduction
The Lua code outputs
1
thennil
(like on this compiler), but using Lupa results in1
and1
.Context
I'm using Lupa to embed Lua into a UI library I'm making. Each widget has its own script, and their
_ENV
-s create a sort of cascade where each widget within a container has access to things defined above it, but not to its siblings. The end goal is something like Alpine.js.I suspect the same cascade would be possible using functions instead of inline
do ... end
scopes, but that massively complicates everything.Cheers, and enjoy the holidays!
The text was updated successfully, but these errors were encountered: