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

Core: Introduce luautils::callGlobal helper #6780

Merged
merged 6 commits into from
Feb 11, 2025
Merged

Core: Introduce luautils::callGlobal helper #6780

merged 6 commits into from
Feb 11, 2025

Conversation

zach2good
Copy link
Contributor

I affirm:

  • I understand that if I do not agree to the following points by completing the checkboxes my PR will be ignored.
  • I understand I should leave resolving conversations to the LandSandBoat team so that reviewers won't miss what was said.
  • I have read and understood the Contributing Guide and the Code of Conduct.
  • I have tested my code and the things my code has changed since the last commit in the PR and will test after any later commits.

What does this pull request do?

Allow calling of functions in Lua from C++ without needing to manually prepare so many things for Lua, or to manually/dangerously access the lua state:

        luautils::callGlobal<void>("xi.server.onServerStart");

etc.

@zach2good zach2good changed the title Core: Introduce luautils::callGlobal helper Core: Introduce luautils::callGlobal helper and more caching Jan 21, 2025
@zach2good zach2good force-pushed the lua_auto_wrap branch 3 times, most recently from 635a0d0 to 8793c87 Compare January 22, 2025 13:58
@zach2good zach2good marked this pull request as ready for review January 22, 2025 13:59
@zach2good zach2good force-pushed the lua_auto_wrap branch 2 times, most recently from 68ebea6 to a230320 Compare January 22, 2025 14:10
@zach2good
Copy link
Contributor Author

Ready for review, works with hot-reloading. Will do some performance testing this week to see if we gain anything from the caching layer

@zach2good zach2good changed the title Core: Introduce luautils::callGlobal helper and more caching Core: Introduce luautils::callGlobal helper and more caching (big performance improvement ⏩) Jan 22, 2025
@zach2good zach2good added the hold On hold, pending further action/info label Jan 22, 2025
@zach2good zach2good force-pushed the lua_auto_wrap branch 3 times, most recently from 4e0cce6 to 0dcf634 Compare January 23, 2025 17:24
@zach2good zach2good changed the title Core: Introduce luautils::callGlobal helper and more caching (big performance improvement ⏩) Core: Introduce luautils::callGlobal helper Feb 9, 2025
@zach2good zach2good force-pushed the lua_auto_wrap branch 4 times, most recently from 4d1e736 to 1b8a4c3 Compare February 9, 2025 11:00
@zach2good
Copy link
Contributor Author

Trying to pin down why this is crashing during CS event updates inside LuaJIT

@zach2good
Copy link
Contributor Author

This ended up shaking out a logical inconsistency that I can't understand why it wasn't crashing before.

When you extract something out of sol, it's lazy-evaluated. If you ask for lua[1][2][3] it won't evaluate until you do something with it. If you do lua[1][2][3]() it evaluates right away. We were pulling out a lua_nil from something, holding onto it for a bit, and then obj()[]ing into it without any additional checks.

I've added those checks in now.

It was around event string updates, so I've run it through the chocobo racing intro, which is the premiere spot for big event updates with arguments and strings.

I've logged in, I've done gobbie box, I've punched some lizards in the face, I've called out trusts and Sneak Attacked off of them, I've used items - everything seems stable now.

Ready to go 👍

@zach2good zach2good removed the hold On hold, pending further action/info label Feb 11, 2025
@zach2good zach2good merged commit 0e14596 into base Feb 11, 2025
13 of 14 checks passed
@zach2good zach2good deleted the lua_auto_wrap branch February 11, 2025 12:00
@zach2good zach2good restored the lua_auto_wrap branch February 11, 2025 12:00
@zach2good zach2good deleted the lua_auto_wrap branch February 11, 2025 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants