[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.1 has a serious issue
- From: Mark Hamburg <mhamburg@...>
- Date: Thu, 12 Jan 2006 09:31:27 -0800
I'm not taking sides on the __len semantics issue, but most of what would be
needed to implement pure Lua objects would be to provide a function taking a
metatable and a regular table and returning a userdata with that metatable
and the regular table as its environment. It makes the code implementing the
object a little more complicated in that it needs to go retrieve the
environment table, but it means that you get all of the behaviors associated
with userdata values. Furthermore, one could use it to implement opaque
objects by making the environment hidden to standard Lua calls and instead
using a private weak table to retrieve it.
Mark