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

Restore Lua 5.1 behavior for lua_tointeger() to mitigate #22. #23

Merged
merged 1 commit into from
Dec 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/third_party/sol2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ Directory `./upstream/` contains single-file version of Sol2 available from
1. Download sol.hpp from [the master
branch](https://github.com/ThePhD/sol2/blob/develop/single/sol/sol.hpp) on
GitHub (or from Releases section) and place it under `./upstream`.
2. Apply a patch for [issue
22](https://github.com/X-Friese/FlyWithLua/issues/22) if it hasn't been
resolved.

```bash
patch -p0 < fix_lua_tointeger.patch
```

Assuming there are no breaking changes, the new version should "just work".

Expand Down
20 changes: 20 additions & 0 deletions src/third_party/sol2/fix_lua_tointeger.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Restore Lua 5.1 behavior for lua_tointeger() for non-sol2 code.

Lua 5.3 introduced integer type along with a breaking change to lua_tointeger,
which refuses to truncate floats to integers anymore. sol2 ships lua-compat-5.3
library with it, which mimics the same behavior, which breaks current
FlyWithLua users.

See: https://github.com/X-Friese/FlyWithLua/issues/22
--- ./upstream/sol.hpp
+++ ./upstream/sol.hpp
@@ -22066,6 +22066,9 @@ namespace sol {
#endif
#endif // Unreal Engine 4 Bullshit

+#undef lua_tointeger
+#undef lua_tointegerx
+
#endif // SOL_HPP
// end of sol.hpp

3 changes: 3 additions & 0 deletions src/third_party/sol2/upstream/sol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22066,6 +22066,9 @@ namespace sol {
#endif
#endif // Unreal Engine 4 Bullshit

#undef lua_tointeger
#undef lua_tointegerx

#endif // SOL_HPP
// end of sol.hpp

Expand Down