Skip to content

Commit b858524

Browse files
authored
Merge pull request agladysh#6 from andryblack/lua52
Full lua 5.2 support resolve agladysh#4
2 parents e6355d4 + 32b4c3d commit b858524

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@
99

1010
*.o
1111
*.so
12+
lib/hiredis/hiredis-example
13+
lib/hiredis/hiredis-test
14+
lib/hiredis/libhiredis.*

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ lua-hiredis bindings contributors:
88

99
Stein Ivar Berghei <[email protected]>
1010
Peter Melnichenko <[email protected]>
11+
Andey Kunitsyn <[email protected]>

src/lua-hiredis.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,22 @@ extern "C" {
3434

3535
#define LUAHIREDIS_KEY_NIL "NIL"
3636

37+
#if LUA_VERSION_NUM >= 502
38+
static void luaL_register(lua_State * L, const char * name, const luaL_Reg * l)
39+
{
40+
if (name)
41+
{
42+
lua_newtable(L);
43+
luaL_setfuncs(L, l, 0);
44+
lua_pushvalue(L,-1);
45+
lua_setglobal(L,name);
46+
} else
47+
{
48+
luaL_setfuncs(L,l,0);
49+
}
50+
}
51+
#endif
52+
3753
typedef struct luahiredis_Enum
3854
{
3955
const char * name;

0 commit comments

Comments
 (0)