[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [Suggestion] Passing upvalues to load()
- From: "Soni L." <fakedme@...>
- Date: Tue, 6 Oct 2015 21:29:17 -0300
On 06/10/15 09:26 PM, Claire Lewis wrote:
In Rio Lua, the order is as they appear. So if a global access
appears before any other upvalue access on a function, _ENV is the
How does order factor in, if the code refers to them by name? I think
I'm overlooking something.
local u2, u3, u4, u5
print(u2, u3, u4, u5) -- _ENV is the first upvalue, because
"print" is actually "_ENV.print" (or "_ENV['print']")
Unless I'm missing something, I don't think this is reliable, that's
an implementation detail, and could change any future version, even a
patch release of 5.3.
The Lua 5.3 manual states: "Upvalues have no particular order, as they
are active through the whole function. They are numbered in an
I'd probably recommend finding a different way to achieve this for a
But it's resonable to assume they're consistent between dump and reload.
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.