Comment by andrewmcwatters

Comment by andrewmcwatters 2 days ago

2 replies

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 a day ago

But.. 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 20 hours ago

    Module exports with side effects, and setting environments doesn’t guarantee global access.