Hacker News new | past | comments | ask | show | jobs | submit login

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



"JavaScript Done Right" requires actually doing it right.


Whatever javascript does, it does not make Lua's default global variables look any better


To be fair, using 'local' instead of 'var' does make the situation a lot clearer.


'Use strict';


This is actually what we do in Lua, often written `require "pl.strict"`...




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: