Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No longer possible to get the lua_State from a uv_loop_t #358

Open
Timothy- opened this issue Jul 8, 2019 · 2 comments · Fixed by #362
Open

No longer possible to get the lua_State from a uv_loop_t #358

Timothy- opened this issue Jul 8, 2019 · 2 comments · Fixed by #362

Comments

@Timothy-
Copy link

Timothy- commented Jul 8, 2019

The macro defined here is incorrect:

luv/src/luv.h

Line 100 in 8a04eeb

#define luv_state(L) (luv_context(L)->L)

In the following example:
lua_State *L = luv_state(uv_req->loop);
will be expanded to:
lua_State *L = (luv_context(uv_req->loop)->uv_req->loop));
causing:
error: 'luv_ctx_t' has no member named 'uv_req'

An improvement would be:
#define luv_state(loop) (luv_context(loop)->L)

Secondly, since luv_context requires lua_State as an argument this macro can no longer be used to go from a uv_loop_t to a lua_State and is effectively useless. If possible I would like the old behaviour back.

zhaozg added a commit to zhaozg/luv that referenced this issue Jul 15, 2019
@zhaozg zhaozg added the bug label Jul 15, 2019
@squeek502
Copy link
Member

Secondly, since luv_context requires lua_State as an argument this macro can no longer be used to go from a uv_loop_t to a lua_State and is effectively useless. If possible I would like the old behaviour back.

As far as I understand, this is no longer possible, as each lua_State* can now have a custom uv_loop_t*, and uv_loop_t* itself does not store any information about a lua_State*.

Relevant PRs/issues:

@squeek502
Copy link
Member

Re-opening this in case we want to try to make it possible to get a lua_State* from a uv_loop_t* again.

@squeek502 squeek502 reopened this Jul 16, 2019
@squeek502 squeek502 changed the title luv_state macro No longer possible to get the lua_State from the uv_loop_t Jul 16, 2019
@squeek502 squeek502 added ? and removed bug labels Jul 16, 2019
@squeek502 squeek502 changed the title No longer possible to get the lua_State from the uv_loop_t No longer possible to get the lua_State from a uv_loop_t Jul 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants