3 ms·
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 mak
by stcredzero 13y ago
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.
- nnq 13y agoGot some sample code or a link to it? I really like figuring out ways to express existing code in a different style/pattern/language :)
- Excavator 13y agoMap¹ 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/Reference/Global_Objects/Map https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- fit2rule 13y agoRefactor 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?