[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Looking for some help - add fenv and other 5.1 features to ravi-distro
- From: Muh Muhten <muh.muhten@...>
- Date: Wed, 28 Nov 2018 02:21:31 -0500
On 11/27/18, Sean Conner <firstname.lastname@example.org> wrote:
> I think there's a bug in the description for string.dump(). It states,
> "[w]hen (re)loaded, those upvalues receive fresh instances containing nil."
> But load() states "When you load a main chunk, the resulting function will
> always have exactly one upvalue, the _ENV variable (see §2.2). However,
> you load a binary chunk created from a function (see string.dump), the
> resulting function can have an arbitrary number of upvalues."
Sure. When (re)loaded, the dumped function has fresh upvalues that
aren't the same as those or any other function, which are initially
nil. Then load() (and lua_load()) set the first upvalue.
... hm, perhaps load setting the first upvalue of functions that
aren't main chunks (linenumber != 0) just doesn't make much sense in
the first place? Or if the incompatibility there seems gratuitous
(maybe it can go into 5.4?), indeed, mention the first upvalue in the
description of string.dump.
Initially I expected lua_load to not set the first upvalue, but that
doesn't seem to be the case.