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

Add userdata to lua_Callbacks #168

Merged
merged 3 commits into from
Nov 8, 2021
Merged

Add userdata to lua_Callbacks #168

merged 3 commits into from
Nov 8, 2021

Conversation

LoganDark
Copy link
Contributor

@LoganDark LoganDark commented Nov 7, 2021

My use case for this is storing data that functions in lua_Callbacks can access, but also anything else that needs VM-wide state rather than thread-local.

@zeux
Copy link
Collaborator

zeux commented Nov 7, 2021

Does L->global->mainthread->userdata work for this use case? If not then I'd probably go with userdata in lua_Callbacks as that way we won't need to invent another way to access this through the official C API.

@LoganDark
Copy link
Contributor Author

LoganDark commented Nov 7, 2021

Does L->global->mainthread->userdata work for this use case?

Not really. This is for userdata global to the whole VM.

If not then I'd probably go with userdata in lua_Callbacks as that way we won't need to invent another way to access this through the official C API.

Are applications not supposed to access global_State directly?

Whoops. I forgot that global_State is apparently a private implementation detail. I generate bindings for all the headers in VM, but you're not technically supposed to do that. ;)

@LoganDark LoganDark changed the title Add userdata to global_State Add userdata to lua_Callbacks Nov 7, 2021
VM/include/lua.h Outdated Show resolved Hide resolved
@zeux zeux merged commit f1649a4 into luau-lang:master Nov 8, 2021
@LoganDark LoganDark deleted the vm_userdata branch November 8, 2021 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants