[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Proxies
- From: RLake@...
- Date: Thu, 16 Jan 2003 20:20:45 -0500
> Regarding those proxies though: I looked in google for lua and proxies,
> and having found nothing, assumed they were not a lua feature.
> Is there any (unofficial/incomplete/whatever) info on them?
Not that I know of. There was a little note from lhf on this list which led
me to look at the source for baselib, and I found them there. Since they
are undocumented, I presume that they are experimental, subject to change,
etc.
But the basic idea is simple enough: Sometimes all you need is a metatable;
creating a whole empty table to attach the metatable to is a bit wasteful.
Creating a zero-length userdata is cheaper, and you can attach a metatable
to it, but the standard interface doesn't allow Lua programs to either
create userdata or manipulate userdata metatables.
Solution: write a little C function which creates a zero-length full
userdata with a specific metatable. The function is, I believe, called
newproxy.
R.
We have the chance to lift millions out of poverty. Only one thing is
missing -- you.
Please join the Oxfam trade campaign at http://www.maketradefair.com
Oxfam works with others to find lasting solutions to poverty and suffering.
Oxfam GB is a member of Oxfam International, a company limited by guarantee and registered in England No. 612172.
Registered office: 274 Banbury Road, Oxford OX2 7DZ.
Registered charity No. 202918.
Visit the web site at http://www.oxfam.org.uk