lua-users home
lua-l archive

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

Answering some my own question, at least for the PUC interpreter:

Based on the description of Lua 5.0:

While locals point to the stack of their functions, upvalues have one
more level of indirection. All functions that share an upvalue share a
pointer to a struct that points to the stack (which itself contains
values). When the parent scope expires, the value is abducted by the
upvalue struct and the original stack is garbage collected.

Reading the upvaluejoin code, it seems that the implementation has
remained the same. It just changes the value of the pointer. The 5.1
debug library can already access the upvalues, it should not be too
hard to replicate the functionality. I have no idea of how to make the
GC aware of the operation, though.

-- Pierre-Yves

On Sat, Jul 28, 2012 at 10:38 AM, Johnson Lin <> wrote:
> 2012/7/28 Pierre-Yves Gérardy <>:
>> On Fri, Jul 27, 2012 at 4:02 PM, Petri Häkkinen <> wrote:
>>> Anyone know if it's possible to back port upvaluejoin() into LuaJIT?
>> I was about to ask the same question.
>> I've checked the source, and it relies on functions absent from v5.1.
>> I'm not familiar enough with the VM to tell you it it is possible or
>> not.
>> -- py
> I was playing the Legend of Grimrock last night (bought it on Steam a
> while ago, but the original post motivated me to actually play it :p),
> excellent stuff. :p
> Sorry, back to the topic. I believe I've seen similar question on LJ
> list, if I understand it correctly:
> The discussion didn't directly mentioned debug.upvaluejoin() in Lua
> 5.2, but apparently that thread didn't come up with a conclusion to
> back port anything from Lua 5.2. OTOH, LuaJIT 2.0 is probably
> officially feature-freezed right now, as the LJ roadmap says. If any
> developers think this is a really important feature, maybe a direct
> mail to Mike Pall or post to LJ list to bring up this again would be
> the right thing to do.
> --
> Johnson