3 ms·
Interesting, it looks like you can use ´global myvar’ now, as compared to ´myvar’ implicit globals, say from back in 5.1, or ´local myvar’. It’s worth noting t
by andrewmcwatters 10mo ago
Interesting, it looks like you can use ´global myvar’ now, as compared to ´myvar’ implicit globals, say from back in 5.1, or ´local myvar’.
It’s worth noting that global is a reserved keyword now, so environments that had a ´global()´ function for escaping environments will now need to rename their helper function.
- darubedarob 10mo agoBut.. why ? Globals are just variables that reside in the wrapping env table that also contain the C functions. If a closures is a onion of table lookups out of the function context from local -> function scope -> global scope is simply the last lookup before a not found variable with nil is declared?
- andrewmcwatters 10mo agoModule exports with side effects, and setting environments doesn’t guarantee global access.