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

WHY? I mean, Lua is a dynamic language with first class functions just like Javascript is, no big difference here.

You can use objects as keys in Lua. This makes a lot of code in Lua a pain to port to JavaScript. I have Lua code I would like to port to JavaScript that this applies to.




Got some sample code or a link to it? I really like figuring out ways to express existing code in a different style/pattern/language :)


Map¹ might've been an option, excepting no support in Safari and IE < 11. Although I dunno about the performance hit, if any.

¹ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...


Refactor once: the object key. To a function returning the value of the object. Refactor a second time: function all the object things.

Whats not to like?




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

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

Search: