no edit summary
(→Details: Explain how getfenv() works equally well) |
No edit summary |
||
| Line 38: | Line 38: | ||
local prevval = globalenv["MyVariable"]; ''-- "getglobal()"'' | local prevval = globalenv["MyVariable"]; ''-- "getglobal()"'' | ||
globalenv["MyVariable"] = 1234; ''-- "setglobal()"'' | globalenv["MyVariable"] = 1234; ''-- "setglobal()"'' | ||
Since calling a function always requires some extra overhead, it's most likely a better idea to not use setglobal and getglobal, but to use the global environment (as above) instead. | |||