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

Port from tolua to sol2 #516

Merged
merged 13 commits into from
Dec 30, 2021
Merged

Conversation

lmoureaux
Copy link
Contributor

@lmoureaux lmoureaux commented Jul 15, 2021

tolua has been unmaintained for a decade and it is tied to a specific Lua version. It makes it more difficult to use the system Lua. It also doesn't play well with C++.

This PR aims at porting the tolua code to sol2. It also makes use of Qt resources to embed the Lua code in the executable (tolua embeds Lua bytecode).

This will help with #387 (removing tolua altogether) and #504.

Test plan:

There shouldn't be any user-visible change...

  • Play with fcdb scripts
  • Play with Lua scripts in rulesets using esp. logging and translations

sol2 will be used for high level Lua operations. This commit imports the
code from https://github.com/ThePhD/sol2/releases/tag/v3.2.2

See longturn#504.
This gets rid of a few lines of tolua-based code.

See longturn#504.
The port to FCDB used sol2's baseline userdata for connection* and
player*, which did not expose the tolua-based API. Define hooks to make
sol2 use tolua, which results in the objects being usable as if sol2
hadn't been used.
This removes most of the need for intermediate functions and also
doesn't require running an external tool.

See longturn#504.
It only contained two thin wrappers around auth.cpp functions. Use the
auth.cpp functions directly instead.
The tolua package tolua_common_z.pkg was only used to lock down the API
and did not depend on any special tolua constructs. Move the code to a .lua
file linked into the executable as a Qt resource. This replaces one
tolua call with sol2.

See longturn#504.
It's documented as an option for the paranoid, which we definitely want to be
for ruleset code.
This moves more code to use sol2 instead of tolua.

See longturn#504.
This is included in a phantom 3.2.3 release of sol2 that doesn't have any
artifacts. See this commit in the sol2 repo:

ThePhD/sol2@e5e6466

This is needed on Windows/MinGW.
@lmoureaux lmoureaux marked this pull request as ready for review December 30, 2021 04:20
@lmoureaux lmoureaux merged commit abd83e3 into longturn:master Dec 30, 2021
@lmoureaux lmoureaux deleted the feature/sol2-port branch December 30, 2021 18:13
@lmoureaux lmoureaux mentioned this pull request Jan 3, 2022
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.

2 participants