[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Multi-dimensional C arrays in Lua
- From: Diego Nehab <diego@...>
- Date: Thu, 22 Jan 2004 19:13:40 -0500 (EST)
Hi,
> I'm wondering if there is some elegant trickery
> I'm not grasping at the moment that would allow
> the access to be written as simply:
>
> x = myarray[1][2]
I once implemented something ugly: myarray had a gettable metamethod
that returned a userdata pointing to the begining of a given row. This
temporary userdata had a different gettable method, that returned the
value at a given column. Back in those days, all userdata were light,
and supported metamethods. Not sure how bad this would be now that
userdata with metamethods are heavy.
[]s,
Diego.