lua-users home
lua-l archive

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


> -----Original Message-----
> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On
> Behalf Of Coroutines
> Sent: maandag 25 augustus 2014 0:50
> To: Lua mailing list
> Subject: Re: rename lua_State
> 
> On Sun, Aug 24, 2014 at 1:02 PM, Thijs Schreijer
> <thijs@thijsschreijer.nl> wrote:
> > As "lua_State" not actually refers to a state, but to a thread or an
> execution stack, could it be renamed? To something that properly reflects
> what it is?
> >
> > I suspect that the name was introduced before coroutines were added, which
> meant that a state and a thread were pretty much the same thing then.
> 
> >From my shallow knowledge of that struct, "lua_Stack" would seem more
> appropriate.

I think lua_Stack is more appropriate than lua_Thread;

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.

Hence lua_Stack would be more appropriate I think.

Thijs