Skip to content

Instantly share code, notes, and snippets.

@martindevans
Created October 4, 2012 22:33
Show Gist options
  • Save martindevans/3836893 to your computer and use it in GitHub Desktop.
Save martindevans/3836893 to your computer and use it in GitHub Desktop.
for (stuff in things)
{
var foo = stuff.thing;
stuff.bar = function()
{
foo.bash(); //Probably not what you wanted!
};
//because all life problems can be solved with a little less readability
function()
{
var foo = stuff.thing;
stuff.bar = function()
{
foo.bash();
};
}();
}
//http://www.lua.org/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment