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
Support Lua 5.2 #21
Conversation
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() |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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. =) |
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. |
@jmaslak Looks good! Thanks for working on this! |
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.