lua-users home
lua-l archive

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


On Thu, Aug 12, 2021 at 2:46 PM Sergey Kaplun
<sergeykaplun1998@gmail.com> wrote:

> Yes, I know, but this part is ommitted in Lua 5.1 Reference Manual [1].
> I just quote the most verbose one.

That is not how this works. Lua 5.1 and Lua 5.4 are different
languages, and whatever one manual says or does not say is not
necessarily true about the other one.

Unless the Lua 5.1 manual is updated, which I doubt, you will have an
implementation-defined behavior. Since your real interest is in
LuaJIT, I am afraid you will have to accept whatever Mike Pall thinks
is right or wrong.

For Lua 5.4, you should have a look at this sentence in the entry on
lua_status(): "You can call functions only in threads with status
LUA_OK". I suspect the status of the newly created thread pointed by
next_cur_L would not be LUA_OK. And that would probably be the case in
Lua 5.1, too.

Another problem with your code is that it pops the new thread from the
Lua stack; it is then usafe to do anything about it, yet this is
exactly what your code does afterwards.

Cheers,
V.


>
> >
> > Cheers,
> > V.
>
> [1]: https://www.lua.org/manual/5.1/manual.html#3.6
>
> --
> Best regards,
> Sergey Kaplun