lua-users home
lua-l archive

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


For the record, I like lua_State.

> On Aug 26, 2014, at 12:39 AM, "Thijs Schreijer" <thijs@thijsschreijer.nl> wrote:
> 
> 
>> -----Original Message-----
>> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On
>> Behalf Of Roberto Ierusalimschy
>> Sent: maandag 25 augustus 2014 20:05
>> To: Lua mailing list
>> Subject: Re: rename lua_State
>> 
>>> Consider code
>>> - In C having L1 as reference
>>> - it calls Lua code
>>> - The Lua code calls another C function, having L2 as reference
>>> 
>>> If you name it lua_Thread, you would assume L1 and L2 would be the same,
>> as they run on the same coroutine/thread. But they are not the same, they
>> both have their own stack to interact with Lua.
>> 
>> But L1 and L2 will be the same (that is, L1 == L2)! Each routine has its
>> own stack, but they use the same PIET to refer to their stacks (unless
>> they are in different threads).
>> 
>> -- Roberto
> 
> The behaviour is different due to the different stacks they use. Hence I thought lua_Stack would be more appropriate. Anyway, lua_State is worse than both others imo.
> 
> I just think it's easier to explain that 2 lua_Stack structures act on their own stacks, but are the same structure (L1 == L2). Than explaining that lua_State is not actually a state at all, but a thread, and then further down the line, depending on where you happen to use it, it acts on different stacks. I've seen many questions here on the list relating to this.
> 
> Anything that better represents its use than lua_State would be fine by me.
> 
> Thijs
>