summaryrefslogtreecommitdiffstats
path: root/main/lua-mosquitto/lua-5.3.patch
blob: 63fc26909531e19d838b8288a2e0ecda29a36044 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
From ec93445eff5ae0fae2f08fe878ef8723890446af Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Mon, 6 Apr 2015 15:01:12 +0200
Subject: [PATCH] add support for Lua 5.3

---
 lua-mosquitto.c | 16 ++++++++--------
 makefile        |  2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/lua-mosquitto.c b/lua-mosquitto.c
index 94da48e..a7e0751 100644
--- a/lua-mosquitto.c
+++ b/lua-mosquitto.c
@@ -236,7 +236,7 @@ static int ctx_will_set(lua_State *L)
 		payload = lua_tolstring(L, 3, &payloadlen);
 	};
 
-	int qos = luaL_optint(L, 4, 0);
+	int qos = luaL_optinteger(L, 4, 0);
 	bool retain = lua_toboolean(L, 5);
 
 	int rc = mosquitto_will_set(ctx->mosq, topic, payloadlen, payload, qos, retain);
@@ -311,7 +311,7 @@ static int ctx_publish(lua_State *L)
 		payload = lua_tolstring(L, 3, &payloadlen);
 	};
 
-	int qos = luaL_optint(L, 4, 0);
+	int qos = luaL_optinteger(L, 4, 0);
 	bool retain = lua_toboolean(L, 5);
 
 	int rc = mosquitto_publish(ctx->mosq, &mid, topic, payloadlen, payload, qos, retain);
@@ -329,7 +329,7 @@ static int ctx_subscribe(lua_State *L)
 	ctx_t *ctx = ctx_check(L, 1);
 	int mid;
 	const char *sub = luaL_checkstring(L, 2);
-	int qos = luaL_optint(L, 3, 0);
+	int qos = luaL_optinteger(L, 3, 0);
 
 	int rc = mosquitto_subscribe(ctx->mosq, &mid, sub, qos);
 
@@ -360,8 +360,8 @@ static int ctx_unsubscribe(lua_State *L)
 static int mosq_loop(lua_State *L, bool forever)
 {
 	ctx_t *ctx = ctx_check(L, 1);
-	int timeout = luaL_optint(L, 2, -1);
-	int max_packets = luaL_optint(L, 3, 1);
+	int timeout = luaL_optinteger(L, 2, -1);
+	int max_packets = luaL_optinteger(L, 3, 1);
 	int rc;
 	if (forever) {
 		rc = mosquitto_loop_forever(ctx->mosq, timeout, max_packets);
@@ -418,7 +418,7 @@ static int ctx_socket(lua_State *L)
 static int ctx_loop_read(lua_State *L)
 {
 	ctx_t *ctx = ctx_check(L, 1);
-	int max_packets = luaL_optint(L, 2, 1);
+	int max_packets = luaL_optinteger(L, 2, 1);
 
 	int rc = mosquitto_loop_read(ctx->mosq, max_packets);
 	return mosq__pstatus(L, rc);
@@ -427,7 +427,7 @@ static int ctx_loop_read(lua_State *L)
 static int ctx_loop_write(lua_State *L)
 {
 	ctx_t *ctx = ctx_check(L, 1);
-	int max_packets = luaL_optint(L, 2, 1);
+	int max_packets = luaL_optinteger(L, 2, 1);
 
 	int rc = mosquitto_loop_write(ctx->mosq, max_packets);
 	return mosq__pstatus(L, rc);
@@ -607,7 +607,7 @@ static int ctx_callback_set(lua_State *L)
 	if (lua_isstring(L, 2)) {
 		callback_type = callback_type_from_string(lua_tostring(L, 2));
 	} else {
-		callback_type = luaL_checkint(L, 2);
+		callback_type = luaL_checkinteger(L, 2);
 	}
 
 	if (!lua_isfunction(L, 3)) {
diff --git a/makefile b/makefile
index 39a5472..1c843aa 100644
--- a/makefile
+++ b/makefile
@@ -1,7 +1,7 @@
 PKGC ?= pkg-config
 
 # lua's package config can be under various names
-LUAPKGC := $(shell for pc in lua lua5.1 lua5.2; do \
+LUAPKGC := $(shell for pc in lua lua5.1 lua5.2 lua5.3; do \
 		$(PKGC) --exists $$pc && echo $$pc && break; \
 	done)
 
-- 
2.3.5