2 ms·
I haven't use Lua, but that sounds exactly like JavaScript objects. JavaScript does get on very well with basically just these objects.
by tikhonj 15y ago
I haven't use Lua, but that sounds exactly like JavaScript objects. JavaScript does get on very well with basically just these objects.
- premchai21 15y agoThey're similar, but the Lua form is much cleaner. In particular, JS objects only permit string keys, which makes Arrays sort of preposterous; they also have other baggage related to the prototype system. Lua tables can have any type except nil (which is not truly first-class in Lua) as keys, and can also have "metatables", which are of similar or greater power to the latter baggage but semantically somewhat simpler. To me this makes a world of difference.