[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.1 upvalues
- From: Anthony Howe <achowe+lua@...>
- Date: Fri, 08 Apr 2011 23:04:36 +0200
On 08/04/2011 21:16, Rob Hoelz whispered from the shadows...:
> If you want C closures to share values, you could store a table as an
> upvalue, store your values in there, and set the same table as an
> upvalue for the closures.
Ugh. One person says no. Another suggests the very thing I want to try
that prompted the question.
In 5.1 does...
lua_newtable(L);
lua_pushvalue(L, -1);
lua_pushcclosure(L, &foobar, 1);
lua_pushcclosure(L, &barblat, 1);
-- rinse & repeat
Work? Can more than one C function share a single upvalue? I ask because
something along these lines has been mentioned in Lua 5.2 as an
alternative to environments or some such without any examples. So I'm
unclear as to whether this is possible in 5.1 and/or 5.2.
So far I have conflicting answers.
>
> -Rob
>
> On Fri, 8 Apr 2011 15:05:31 -0400
> Patrick Donnelly <batrick@batbytes.com> wrote:
>
>> On Fri, Apr 8, 2011 at 1:46 PM, Anthony Howe <achowe+lua@snert.com>
>> wrote:
>>> Can Lua 5.1 upvalues be associated with more than one C closure?
>>
>> No.
>>
>
--
Anthony C Howe Skype: SirWumpus SnertSoft
Twitter: SirWumpus BarricadeMX & Milters
http://snert.com/ http://nanozen.info/ http://snertsoft.com/