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

Support Lua 5.2 #21

Merged
merged 5 commits into from Apr 25, 2016
Merged

Support Lua 5.2 #21

merged 5 commits into from Apr 25, 2016

Conversation

jmaslak
Copy link
Contributor

@jmaslak jmaslak commented Apr 16, 2016

Howdy, I got your module as part of the CPAN Pull Challenge.

In trying to install it on my machine, I found that it's fairly particular about which version of Lua is installed - it needs 5.1 while I had 5.2. This patch adds support for 5.2, which required slight modifications to the code (the Lua API changed a bit) and to the test scripts (some scripts that work in 5.1 don't work in 5.2 without slight modifications).

I validated that the tests do pass on 5.1 as well. Please let me know if you would like me to approach any of this a different way - I'm glad to refactor to fit your project appropriately.

@hoelzro
Copy link
Owner

hoelzro commented Apr 18, 2016

Hi there! Thanks for sending this my way; I'll look over the changes and leave my comments on there.

@@ -14,9 +15,17 @@
#include <lualib.h>
#include <lauxlib.h>

/* Support Lua 5.2 */
#if LUA_VERSION_NUM >= 502
#define lua_open() luaL_newstate()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how lua_open snuck through; honestly, rather than using this macro, we should probably change all usage of lua_open to lua_newstate, or even luaL_newstate and remove the library loading code here: https://github.com/hoelzro/inline-lua/blob/master/Lua.xs#L495

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the lua_open() and replaced it with luaL_newstate(). I didn't quite understand what you meant by removing the library loading code - if you meant the lua_open(...) stuff for LUA_VERSION_NUM <= 501, I think I did the right thing in a subsequent commit.

@hoelzro
Copy link
Owner

hoelzro commented Apr 18, 2016

I've left a few comments; overall, it looks good! I just suggested some small stylistic changes and some cleanup that I myself neglected to do. =)

@jmaslak
Copy link
Contributor Author

jmaslak commented Apr 18, 2016

Great comments - I agree with all your comments and will put together another commit this week. Good catch on the stdio.h - I had it in there during some debugging and forgot to rip it back out.

@hoelzro
Copy link
Owner

hoelzro commented Apr 25, 2016

@jmaslak Looks good! Thanks for working on this!

@hoelzro hoelzro merged commit 3b026bd into hoelzro:master Apr 25, 2016
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.

None yet

2 participants