Hacker News new | ask | show | jobs
by kybernetikos 3928 days ago
> Cost of implementing Lua tables, meta-tables

Tables and meta tables are nearly identical to objects and prototypes in javascript. Why would the cost of implementing them be high?

1 comments

JavaScript objects are indexed by strings. Lua tables are indexed by arbitrary objects. In JS a[1] and a["1"] are the same element but they are different in Lua. In Lua a[{}] is a new element indexed by the identity of the new object literal, and will be a different element every time the expression is evaluated.