3 ms·
It's the same in JavaScript: x = 5; // global var x = 5; // local Lua just replaces var with local: x = 5 -- global local x = 5 -- local
by panic 13y ago
It's the same in JavaScript:
x = 5; // global
var x = 5; // local
Lua just replaces var with local:
x = 5 -- global
local x = 5 -- local
- riquito 13y agoWhatever javascript does, it does not make Lua's default global variables look any better
- nilkn 13y agoTo be fair, using 'local' instead of 'var' does make the situation a lot clearer.
- icambron 13y ago"JavaScript Done Right" requires actually doing it right.
- woah 13y ago'Use strict';
- catwell 13y agoThis is actually what we do in Lua, often written `require "pl.strict"`...