Re: Minor documentation inconsistency
Peter Clayton <[email protected]> Mon, 6 Jul 2026 15:30:07 -0700 (PDT)
| Newsgroups | gmane.comp.lang.lua.general |
|---|---|
| Message-ID | <[email protected]> |
> > It seems like "global attnamelist" is also wrong in another way: When you > > don't supply the ['=' explist], it doesn't accept a spread attribute (first > > attribute shared between all declared values). > > Are you talking about the code or the documentation? Which version? I'm talking about the Lua 5.5 documentation: https://lua.org/manual/5.5/manual.html#9. > Each line in the REPL is an independent chunk. The scope of 'global' goes > only until the end of the chunk (in that case, end of the line). That makes sense. Maybe a warning would be nice though. Locals say "warning: locals do not survive across lines in interactive mode", and something similar would work, but it should also mention how it's just the restriction of access to globals that doesn't survive, while declaring globals with values assigned does also declare them in a way that makes them persist across lines. -- Peter On Monday, July 6, 2026 at 1:59:34 PM UTC-4 Roberto Ierusalimschy wrote: > > It seems like "global attnamelist" is also wrong in another way: When > you > > don't supply the ['=' explist], it doesn't accept a spread attribute > (first > > attribute shared between all declared values). > > Are you talking about the code or the documentation? Which version? > > > > Also, it seems like it ignores the const-ness of global variables. > > Valid: > > > global test<const> = 45 > > > test = 23 > > > > What's up with that? > > Each line in the REPL is an independent chunk. The scope of 'global' goes > only until the end of the chunk (in that case, end of the line). > > -- Roberto > -- You received this message because you are subscribed to the Google Groups "lua-l" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/lua-l/9b532ebc-ad83-4a66-a04b-629663314d23n%40googlegroups.com.