lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Apr 22, 2010 at 9:27 AM, Ted Unangst <ted.unangst@gmail.com> wrote:
> But in order to get access to the width and height, I needed to use
> getters ("img:width()", as a call) which are annoying.  I want
> "img.width" to work.

I'd suggest getting it to work in vanilla Lua first.  This sounds like
a job for the 'proxy table' pattern.  Property access fires __index,
which is a function which looks up the value in the actual table (and
may even call a setter, if defined). Ditto for __newindex.

steve d.